sort on huge table - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject sort on huge table
Date
Msg-id 199910131003.TAA06423@srapc451.sra.co.jp
Whole thread Raw
Responses Re: [HACKERS] sort on huge table
List pgsql-hackers
I came across problems with sorting a huge (2.4GB) table.

o it took 46 minutes to complete following query:
select * from test2 order by i desc limit 100;
 to get 0 results.
i|t-+-(0 rows)
 I assume this is a failure.
 note: this is Pentium III x2 with 512MB RAM running RedHat Linux 6.0.

o I got NOTICE:  BufFileRead: should have flushed after writing at the very end of the processing.

o it produced 7 sort temp files each having size of 1.4GB (total 10GB)

Here is the table I used for testing(no index):

CREATE TABLE test2 (       i int4,       t text);

This has 10000000 records and the table file sizes are:

$ ls -ls test2*
1049604 -rw-------   1 postgres postgres 1073741824 Oct  4 18:32 test2
1049604 -rw-------   1 postgres postgres 1073741824 Oct  5 01:19 test2.1327420 -rw-------   1 postgres postgres
334946304Oct 13 17:40 test2.2
 

--
Tatsuo Ishii


pgsql-hackers by date:

Previous
From: Chairudin Sentosa Harjo
Date:
Subject: Re: [HACKERS] Updated book outline
Next
From: "Hiroshi Inoue"
Date:
Subject: RE: Scan by TID (was RE: [HACKERS] How to add a new build-in operator)