Re: Optimize single tuple fetch from nbtree index

Поиск
Список
Период
Сортировка
От Michail Nikolaev
Тема Re: Optimize single tuple fetch from nbtree index
Дата
Msg-id CANtu0ojevERgXN-PnTECm+=5f6Sgdh3ffYnkiAQcEQKvTt2new@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Optimize single tuple fetch from nbtree index  (Peter Geoghegan <pg@bowt.ie>)
Список pgsql-hackers
Hello everyone.

I am also was looking into possibility of such optimisation few days ago (attempt to reduce memcpy overhead on IndexOnlyScan).

One thing I noticed here - whole page is scanned only if index quals are "opened" at some side.

So,  in case of
     SELECT* FROM tbl WHERE k=:val AND ts<=:timestamp ORDER BY k, ts DESC LIMIT 1;
whole index page will be read.

But
    SELECT* FROM tbl WHERE k=:val AND ts<=:timestamp AND ts<:=timestamp - :interval  ORDER BY k, ts DESC LIMIT 1;
is semantically the same, but only few :interval records will be processed.

So, you could try to compare such query in your benchmarks.

Also, some info about current design is contained in src\backend\access\nbtree\README ("To minimize lock/unlock traffic, an index scan always searches a leaf page
to identify all the matching items at once").

Thanks,
 Michail.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Re[2]: jsonb_plperl bug
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Redacting information from logs