On Mon, Jan 26, 2015 at 8:43 AM, Andrew Gierth <and...@tao11.riddles.org.uk> wrote: > Another spinoff from the abbreviation discussion. Peter Geoghegan > suggested on IRC that numeric would benefit from abbreviation, and > indeed it does (in some cases by a factor of about 6-7x or more, because > numeric comparison is no speed demon).
Cool. What I find particularly interesting about this patch is that it makes sorting numerics significantly faster than even sorting float8 values, at least some of the time, even though the latter has generic SortSupport (for fmgr elision). Example: postgres=# create table foo as select x::float8 x, x::numeric y from (select random() * 10000000 x from generate_series(1,1000000) a) b; SELECT 1000000 This query takes about 525ms after repeated executions: select * from (select * from foo order by x offset 1000000000) i; However, this query takes about 412ms: select * from (select * from foo order by y offset 1000000000) i; There is probably a good case to be made for float8 abbreviation support....just as well that your datum abbreviation patch doesn't imply that pass-by-value types cannot be abbreviated across the board (it only implies that abbreviation of pass-by-value types is not supported in the datum sort case). :-) Anyway, the second query above (the one with the numeric ORDER BY column) is enormously faster than the same query executed against master's tip. That takes about 1720ms following repeated executions. So at least that case is over 4x faster, suggesting that abbreviation support for numeric is well worthwhile. So I'm signed up to review this one too. -- Peter Geoghegan -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers