Re: B-Tree support function number 3 (strxfrm() optimization)

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Peter Geoghegan <pg(at)heroku(dot)com>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, Marti Raudsepp <marti(at)juffo(dot)org>, Stephen Frost <sfrost(at)snowman(dot)net>, Greg Stark <stark(at)mit(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: B-Tree support function number 3 (strxfrm() optimization)
Date: 2015-01-20 23:27:43
Message-ID: 87y4oxkpxs.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Robert" == Robert Haas <robertmhaas(at)gmail(dot)com> writes:

Robert> All right, it seems Tom is with you on that point, so after
Robert> some study, I've committed this with very minor modifications.

While hacking up a patch to demonstrate the simplicity of extending this
to the Datum sorter, I seem to have run into a fairly major issue with
this: there seems to be no attempt whatsoever to handle spilling to disk
correctly. The data spilled to disk only has the un-abbreviated values,
but nothing tries to re-abbreviate it (or disable abbreviations) when it
is read back in, and chaos ensues:

set work_mem = 64;
select v, v > lag(v) over (order by v)
from (select 'B'||i as v from generate_series(1,10000) i
union all select 'a'||i from generate_series(1,10000) i offset
0) s
order by v limit 20;

v | ?column?
--------+----------
a10000 |
B10000 | f
a1000 | t
a1001 | t
a1002 | t
a1003 | t
B1000 | f
B1001 | t
B1002 | t
B1003 | t
B1004 | t
B1005 | t
a1004 | t
a1005 | t
a1006 | t
a1007 | t
a1008 | t
B1 | f
B10 | t
B100 | t
(20 rows)

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G Johnston 2015-01-20 23:32:17 Re: Add min and max execute statement time in pg_stat_statement
Previous Message Tomas Vondra 2015-01-20 22:37:20 Re: PATCH: decreasing memory needlessly consumed by array_agg