Re: Tid scan improvements
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Edmund Horner <ejrh00@gmail.com>, David Fetter <david@fetter.org>, Michael Paquier <michael@paquier.xyz>,
Alvaro Herrera <alvherre@2ndquadrant.com>, Thomas Munro <thomas.munro@gmail.com>, David Steele <david@pgmasters.net>, Tom Lane <tgl@sss.pgh.pa.us>, Tomas Vondra <tomas.vondra@2ndquadrant.com>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2021-02-27T10:05:53Z
Lists: pgsql-hackers
On Fri, 19 Feb 2021 at 20:37, David Rowley <dgrowleyml@gmail.com> wrote: > > On Thu, 18 Feb 2021 at 09:45, David Rowley <dgrowleyml@gmail.com> wrote: > > > > On Wed, 17 Feb 2021 at 11:05, Andres Freund <andres@anarazel.de> wrote: > > > How does this interact with rescans? > > > > We must call table_rescan() before calling table_set_tidrange() again. > > That perhaps could be documented better. I'm just unsure if that > > should be documented in tableam.h or if it's a restriction that only > > needs to exist in heapam.c > > I've changed things around so that we no longer explicitly call > table_rescan() in nodeTidrangescan.c. Instead table_set_tidrange() > does a rescan call. I also adjusted the documentation to mention that > changing the tid range starts the scan again. This does mean we'll do > a ->scan_rescan() the first time we do table_set_tidrange(). I'm not > all that sure that matters. I've pushed this now. I did end up changing the function name in tableam.h so that we no longer expose the table_set_tidrange(). Instead, the range is set by either table_beginscan_tidrange() or table_rescan_tidrange(). There's no need to worry about what would happen if someone were to change the TID range mid-scan. Apart from that, I adjusted a few comments and changed the regression tests a little to get rid of the tidrangescan_empty table. This was created to ensure empty tables work correctly. Instead, I just did those tests before populating the tidrangescan table. This just makes the test run a little faster since we're creating and dropping 1 less table. David
Commits
-
Add TID Range Scans to support efficient scanning ranges of TIDs
- bb437f995d47 14.0 landed
-
Improve planner's selectivity estimates for inequalities on CTID.
- f7111f72d2fd 12.0 landed