Re: BUG #19086: pg_dump --data-only selects and do not uses index definitions for the dumped tables.
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Nathan Bossart <nathandbossart@gmail.com>, andrewbille@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2025-10-16T01:36:23Z
Lists: pgsql-bugs
On Thu, 16 Oct 2025 at 14:31, Tom Lane <tgl@sss.pgh.pa.us> wrote: > > David Rowley <dgrowleyml@gmail.com> writes: > > Just to put that to the test, I tried the attached. > > I'm confused by all the extraneous changes in this? It includes the query rewrite too in order to get rid of the subqueries in the targetlist to pg_attribute. There are 3 of those in total. When ignore_system_indexes is on, that means a 3x Seq Scans to pg_attribute per returned row. The rewrite gets rid of that and turns that into a single join to pg_attribute which allows the planner to hash or merge join to it. We could just do the conditional calling of the pg_get_*def() functions, but performance would still be terrible for ignore_system_indexes=on due to the Seq Scans, and slightly worse overall. David