Using unique btree indexes for pathkeys with one extra column

Поиск
Список
Период
Сортировка
От Thomas Munro
Тема Using unique btree indexes for pathkeys with one extra column
Дата
Msg-id CA+hUKGKiALY1Ux57hrxn8qiZFRUerS8tR9qAdMMpoV7=eVQ6AA@mail.gmail.com
обсуждение исходный текст
Ответы Re: Using unique btree indexes for pathkeys with one extra column  (David Rowley <david.rowley@2ndquadrant.com>)
Re: Using unique btree indexes for pathkeys with one extra column  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hello,

In the category "doing more tricks with our existing btrees", which
includes all that difficult stuff like skip scans and incremental
sort, here's an easier planner-only one:  if you have a unique index
on (a) possibly "including" (b) and you have a pathkey (a, b), you can
use an index [only] scan.  That is, if the index is unique, and you
want exactly one extra column in index order, then you don't need any
extra sorting to get (a, b) in order.  (If the index is not unique, or
there is more than one extra trailing column in the pathkey, you need
the incremental sort patch[1] to use this index).  This was brought to
my attention by a guru from a different RDBMS complaining about stupid
stuff that PostgreSQL does and I was triggered to write this message
as a kind of TODO note...

[1] https://commitfest.postgresql.org/24/1124/

-- 
Thomas Munro
https://enterprisedb.com



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: Change ereport level for QueuePartitionConstraintValidation
Следующее
От: Tomas Vondra
Дата:
Сообщение: Re: [sqlsmith] Crash in mcv_get_match_bitmap