| From: | David Rowley <dgrowleyml(at)gmail(dot)com> |
|---|---|
| To: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
| Cc: | Andreas Karlsson <andreas(at)proxel(dot)se>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Add sortsupport to money_ops, pg_lsn_ops and xid8_ops |
| Date: | 2026-12-03 20:58:40 |
| Message-ID: | CAApHDvpLKXRGdOXcg89cxVB5p=1355tjZHHNPboP_GoTkRO04g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, 3 Dec 2026 at 10:07, Corey Huinker <corey(dot)huinker(at)gmail(dot)com> wrote:
> 2. customers with at least 1 money column: 2.68%
> I had hoped that this research would show that usage was vanishingly small, giving us a reason to pursue a more aggressive deprecation schedule, but that doesn't appear to be the case.
Yeah. I'm surprised. Could you get some stats on indexes using money_ops?: e.g:
SELECT count(*) FROM pg_index WHERE (SELECT oid FROM pg_opclass WHERE
opcname = 'money_ops') = ANY (indclass::oid[]);
In theory, if we were to ever move money to contrib, then providing
another type based on int64 / 100 and adding a WITHOUT FUNCTION cast
would allow switching to the new type without table rewrites.
I once wrote a type called fixeddecimal [1] which does that, same as
money. The following seems to work without a table rewrite.
CREATE EXTENSION IF NOT EXISTS fixeddecimal;
CREATE CAST (money AS fixeddecimal) WITHOUT FUNCTION AS ASSIGNMENT;
CREATE TABLE m (a money);
INSERT INTO m SELECT 123.45 FROM generate_series(1,1000000);
\timing on
ALTER TABLE m ALTER COLUMN a TYPE fixeddecimal;
\timing off
SELECT * FROM m LIMIT 10;
But it's slow if you create an index on m(a) as the index needs rebuilt.
David
[1] https://github.com/2ndQuadrant/fixeddecimal (I did need to adjust
the Makefile to change "12" to "20")
| From | Date | Subject | |
|---|---|---|---|
| Next Message | surya poondla | 2026-12-03 20:59:08 | Re: Be strict when request to flush past end of WAL in WaitXLogInsertionsToFinish |
| Previous Message | Alexander Korotkov | 2026-12-03 20:28:51 | Re: test: avoid redundant standby catchup in 049_wait_for_lsn |