Add sortsupport to money_ops, pg_lsn_ops and xid8_ops
Add sortsupport to money_ops, pg_lsn_ops and xid8_ops
While benchmarking the effects of the recent (41467b1d88) GIN speedup, I noticed that btree opclasses for money/pg_lsn/xid8 have no sortsupport I think this is a clear miss, so PFA This can speedup CREATE INDEX on money type in ~20%, try CREATE TABLE m AS SELECT (hashint8(i)::numeric/100)::money FROM generate_series(1,1000000) i; create index on m (money ); -- 339ms base vs 260ms patched for me Also, ORDER BY col would also be faster. Maybe merge join will get benefit - i didn't measure this -- Best regards, Kirill Reshke
Re: Add sortsupport to money_ops, pg_lsn_ops and xid8_ops
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Kirill Reshke writes: > While benchmarking the effects of the recent (41467b1d88) GIN speedup, > I noticed that btree opclasses for money/pg_lsn/xid8 have no > sortsupport Is it really worth the development and ongoing maintenance costs to carry such code? I doubt many users are doing large sorts on columns of these data types. regards, tom lane
Re: Add sortsupport to money_ops, pg_lsn_ops and xid8_ops
От:
Andrey Borodin <x4mmm@yandex-team.ru>
Дата:
> On 6 Nov 2026, at 21:24, Tom Lane wrote: > > Is it really worth the development and ongoing maintenance costs > to carry such code? I doubt many users are doing large sorts on > columns of these data types. I've definitely seen people sort moneys. But IMO, the patch is more about feature alignment than practical benefit. Best regards, Andrey Borodin.
Re: Add sortsupport to money_ops, pg_lsn_ops and xid8_ops
On Fri, Nov 06, 2026 at 09:53:05PM +0500, Andrey Borodin wrote: > But IMO, the patch is more about feature alignment than practical benefit. I could get behind the money part. The two others? Let me doubt. -- Michael
Re: Add sortsupport to money_ops, pg_lsn_ops and xid8_ops
От:
Kirill Reshke <reshkekirill@gmail.com>
Дата:
On Fri, 6 Nov 2026 at 21:24, Tom Lane wrote: > > Kirill Reshke writes: > > While benchmarking the effects of the recent (41467b1d88) GIN speedup, > > I noticed that btree opclasses for money/pg_lsn/xid8 have no > > sortsupport > > Is it really worth the development and ongoing maintenance costs > to carry such code? I doubt many users are doing large sorts on > columns of these data types. > Hi! Thanks for looking. It didn't occur to me that this would require any maintenance cost. Saying that, I think money type is something people use -- Best regards, Kirill Reshke
Re: Add sortsupport to money_ops, pg_lsn_ops and xid8_ops
От:
David Rowley <dgrowleyml@gmail.com>
Дата:
On Mon, 9 Nov 2026 at 17:10, Kirill Reshke wrote: > It didn't occur to me that this would require any maintenance cost. > Saying that, I think money type is something people use Any basis for those thoughts? I've only ever seen its usage discouraged and even a short discussion [1] on how we might remove it one day. Perhaps we should make pg_upgrade start kicking out warnings in v20 and then remove it in v25... Or reconsider that if we receive too many complaints. David [1] https://postgr.es/m/ZXgh74Ykj3iWvXKr@paquier.xyz
Re: Add sortsupport to money_ops, pg_lsn_ops and xid8_ops
От:
Andreas Karlsson <andreas@proxel.se>
Дата:
On 11/9/26 08:53, David Rowley wrote: > On Mon, 9 Nov 2026 at 17:10, Kirill Reshke wrote: >> It didn't occur to me that this would require any maintenance cost. >> Saying that, I think money type is something people use > > Any basis for those thoughts? I've only ever seen its usage > discouraged and even a short discussion [1] on how we might remove it > one day. > > Perhaps we should make pg_upgrade start kicking out warnings in v20 > and then remove it in v25... Or reconsider that if we receive too many > complaints. Yeah, I think we should deprecate the money type. It is weird and confusing to any user and the name makes some people think that it is useful for storing money when it is generally not. I would rather that we work on deprecating it over improving it. Maybe it can be turned into an extension for the people who want it, but the issue is pg_upgrade and type type oid. -- Andreas Karlsson Percona