Reverse collations (initially for making keyset pagination covermore cases)

Поиск
Список
Период
Сортировка
От David Fetter
Тема Reverse collations (initially for making keyset pagination covermore cases)
Дата
Msg-id 20191117182408.GA13566@fetter.org
обсуждение исходный текст
Ответы Re: Reverse collations (initially for making keyset pagination cover more cases)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Folks,

Please find attached a patch for $Subject.

Motivation:

When people are doing keyset pagination, the simple cases redound to
adding a WHERE that looks like

    (a, b, c) > (most_recent_a, most_recent_b, most_recent_c)

which corresponds to an ORDER BY clause that looks like

    ORDER BY a, b, c

The fun starts when there are mixes of ASC and DESC in the ORDER BY
clause. Reverse collations make this simpler by inverting the meaning
of > (or similar), which makes the rowtypes still sortable in a new
dictionary order, so the pagination would look like:


    (a, b, c) > (most_recent_a, most_recent_b COLLATE "C_backwards", most_recent_c)

with an ORDER BY like:

    ORDER BY a, b DESC, c

What say?

Best,
David.
-- 
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

Вложения

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

Предыдущее
От: Alexander Korotkov
Дата:
Сообщение: Re: Connections hang indefinitely while taking a gin index's LWLockbuffer_content lock(PG10.7)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Reverse collations (initially for making keyset pagination cover more cases)