Cott Lang <cott@internetstaff.com> writes:
> sort_mem = 8192
> random_page_cost = 2
> effective_cache_size = 3932160
effective_cache_size 30Gb ? Seems a tad high ;-)
However, I set up a dummy test case on 7.4.5 and don't see any overflow.
regression=# create table z1(f1 char(1253));
CREATE TABLE
regression=# update pg_class set reltuples=2023865, relpages=65000 where relname = 'z1';
UPDATE 1
regression=# set sort_mem = 8192;
SET
regression=# set random_page_cost = 2;
SET
regression=# set effective_cache_size = 3932160;
SET
regression=# explain select * from z1 order by f1;
QUERY PLAN
---------------------------------------------------------------------
Sort (cost=2200533.17..2205592.83 rows=2023865 width=1257)
Sort Key: f1
-> Seq Scan on z1 (cost=0.00..85238.65 rows=2023865 width=1257)
(3 rows)
Can you try this exact test case and see if you get a NAN?
regards, tom lane