[PATCH] sort leaf pages by ctid for gist indexes built using sorted method

From: Aliaksandr Kalenik <akalenik(at)kontur(dot)io>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH] sort leaf pages by ctid for gist indexes built using sorted method
Date: 2021-12-15 14:47:05
Message-ID: CAHqSB9gd0NnQuPHSnnR7BC-rNnJWZ53rRA+vYZF4pcRK-4y_kw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

With the current implementation, for GiST indexes created by doing multiple
inserts, index tuples match heap tuples order, but it doesn't work that way
for sorted method where index tuples on all levels are ordered using
comparator provided in sortsupport (z-order for geometry type, for
example). This means two tuples that are on the same heap page can be far
apart from one another on an index page, and the heap page may be read
twice and prefetch performance will degrade.

I've created a patch intended to improve that by sorting index tuples by
heap tuples TID order on leaf pages.

Attachment Content-Type Size
gist_sortsupport_sort_leaf_pages_by_ctid.patch application/octet-stream 1.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2021-12-15 14:49:14 Re: Skipping logical replication transactions on subscriber side
Previous Message Justin Pryzby 2021-12-15 14:42:45 Re: Adding CI to our tree