pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Add TID Range Scans to support efficient scanning ranges of TIDs
4+ messages / 3 participants
[nested] [flat]
* pgsql: Add TID Range Scans to support efficient scanning ranges of TIDs
@ 2021-02-27 10:01 David Rowley <drowley@postgresql.org>
0 siblings, 1 reply; 4+ messages in thread
From: David Rowley @ 2021-02-27 10:01 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Add TID Range Scans to support efficient scanning ranges of TIDs
This adds a new executor node named TID Range Scan. The query planner
will generate paths for TID Range scans when quals are discovered on base
relations which search for ranges on the table's ctid column. These
ranges may be open at either end. For example, WHERE ctid >= '(10,0)';
will return all tuples on page 10 and over.
To support this, two new optional callback functions have been added to
table AM. scan_set_tidrange is used to set the scan range to just the
given range of TIDs. scan_getnextslot_tidrange fetches the next tuple
in the given range.
For AMs were scanning ranges of TIDs would not make sense, these functions
can be set to NULL in the TableAmRoutine. The query planner won't
generate TID Range Scan Paths in that case.
Author: Edmund Horner, David Rowley
Reviewed-by: David Rowley, Tomas Vondra, Tom Lane, Andres Freund, Zhihong Yu
Discussion: https://postgr.es/m/CAMyN-kB-nFTkF=VA_JPwFNo08S0d-Yk0F741S2B7LDmYAi8eyA@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/bb437f995d47405ecd92cf66df71f7f7e40ed460
Modified Files
--------------
src/backend/access/heap/heapam.c | 147 ++++++++++
src/backend/access/heap/heapam_handler.c | 3 +
src/backend/commands/explain.c | 23 ++
src/backend/executor/Makefile | 1 +
src/backend/executor/execAmi.c | 6 +
src/backend/executor/execCurrent.c | 1 +
src/backend/executor/execProcnode.c | 10 +
src/backend/executor/nodeTidrangescan.c | 413 +++++++++++++++++++++++++++++
src/backend/nodes/copyfuncs.c | 24 ++
src/backend/nodes/outfuncs.c | 14 +
src/backend/optimizer/README | 1 +
src/backend/optimizer/path/costsize.c | 95 +++++++
src/backend/optimizer/path/tidpath.c | 119 ++++++++-
src/backend/optimizer/plan/createplan.c | 98 +++++++
src/backend/optimizer/plan/setrefs.c | 16 ++
src/backend/optimizer/plan/subselect.c | 6 +
src/backend/optimizer/util/pathnode.c | 29 ++
src/backend/optimizer/util/plancat.c | 6 +
src/backend/optimizer/util/relnode.c | 3 +
src/backend/storage/page/itemptr.c | 59 +++++
src/include/access/heapam.h | 6 +-
src/include/access/relscan.h | 4 +
src/include/access/tableam.h | 97 ++++++-
src/include/catalog/pg_operator.dat | 6 +-
src/include/executor/nodeTidrangescan.h | 24 ++
src/include/nodes/execnodes.h | 18 ++
src/include/nodes/nodes.h | 3 +
src/include/nodes/pathnodes.h | 18 ++
src/include/nodes/plannodes.h | 13 +
src/include/optimizer/cost.h | 3 +
src/include/optimizer/pathnode.h | 4 +
src/include/storage/itemptr.h | 2 +
src/test/regress/expected/tidrangescan.out | 300 +++++++++++++++++++++
src/test/regress/parallel_schedule | 2 +-
src/test/regress/serial_schedule | 1 +
src/test/regress/sql/tidrangescan.sql | 101 +++++++
36 files changed, 1654 insertions(+), 22 deletions(-)
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pgsql: Add TID Range Scans to support efficient scanning ranges of TIDs
@ 2021-03-01 15:25 Alvaro Herrera <alvherre@alvh.no-ip.org>
parent: David Rowley <drowley@postgresql.org>
0 siblings, 1 reply; 4+ messages in thread
From: Alvaro Herrera @ 2021-03-01 15:25 UTC (permalink / raw)
To: David Rowley <drowley@postgresql.org>; +Cc: pgsql-committers@lists.postgresql.org
On 2021-Feb-27, David Rowley wrote:
> Add TID Range Scans to support efficient scanning ranges of TIDs
Hmm, this seems to have missed a catversion bump, and we haven't had one
since it went in ...
--
Álvaro Herrera Valdivia, Chile
"Find a bug in a program, and fix it, and the program will work today.
Show the program how to find and fix a bug, and the program
will work forever" (Oliver Silfridge)
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pgsql: Add TID Range Scans to support efficient scanning ranges of TIDs
@ 2021-03-01 17:55 Tom Lane <tgl@sss.pgh.pa.us>
parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 1 reply; 4+ messages in thread
From: Tom Lane @ 2021-03-01 17:55 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: David Rowley <drowley@postgresql.org>; pgsql-committers@lists.postgresql.org
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> On 2021-Feb-27, David Rowley wrote:
>> Add TID Range Scans to support efficient scanning ranges of TIDs
> Hmm, this seems to have missed a catversion bump, and we haven't had one
> since it went in ...
I've not read the patch in detail, but offhand I don't see why it would
need a catversion bump. It doesn't look to have changed any persistent
data structures.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pgsql: Add TID Range Scans to support efficient scanning ranges of TIDs
@ 2021-03-01 18:07 Alvaro Herrera <alvherre@alvh.no-ip.org>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 4+ messages in thread
From: Alvaro Herrera @ 2021-03-01 18:07 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David Rowley <drowley@postgresql.org>; pgsql-committers@lists.postgresql.org
On 2021-Mar-01, Tom Lane wrote:
> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> > On 2021-Feb-27, David Rowley wrote:
> >> Add TID Range Scans to support efficient scanning ranges of TIDs
>
> > Hmm, this seems to have missed a catversion bump, and we haven't had one
> > since it went in ...
>
> I've not read the patch in detail, but offhand I don't see why it would
> need a catversion bump. It doesn't look to have changed any persistent
> data structures.
Oh, so it appears you're right -- there are NodeTag renumberings but
those aren't stored anywhere.
--
Álvaro Herrera Valdivia, Chile
Bob [Floyd] used to say that he was planning to get a Ph.D. by the "green
stamp method," namely by saving envelopes addressed to him as 'Dr. Floyd'.
After collecting 500 such letters, he mused, a university somewhere in
Arizona would probably grant him a degree. (Don Knuth)
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2021-03-01 18:07 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-02-27 10:01 pgsql: Add TID Range Scans to support efficient scanning ranges of TIDs David Rowley <drowley@postgresql.org>
2021-03-01 15:25 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2021-03-01 17:55 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-03-01 18:07 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox