Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] sorting big tables :(

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: scrappy(at)hub(dot)org (The Hermit Hacker)
Cc: mimo(at)interdata(dot)com(dot)pl, hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] sorting big tables :(
Date: 1998-05-20 14:23:35
Message-ID: 199805201423.KAA14079@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
> > Well, I think it might be optimised slightly. Am I right that postgres
> > uses heap (i.e. they look like tables) files during sorting? While this
> > is a merge sort, those files doesn't have to be a table-like files.
> > Certainly, they might variable length records without pages (aren't they
> > used sequentially). Moreover we would consider packing tape files before
> > writting them down if necessary. Of course it will result in some
> > performance dropdown. However it's better to have less performance that
> > being unable to sort it at all.
> > 
> > Last question... What's the purpose of such a big sort? If somebody gets
> > 40M of sorted records in a result of some query, what would he do with
> > it? Is he going to spent next years on reading this lecture? I mean,
> > isn't it worth to query the database for necessary informations only and
> > then sort it?
> 
> 	this I don't know...I never even really thought about that,
> actually...Michael? :)  Only you can answer that one.

I have an idea.  Can he run CLUSTER on the data?  If so, the sort will
not use small batches, and the disk space during sort will be reduced. 
However, I think CLUSTER will NEVER finish on such a file, unless it is
already pretty well sorted.


-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

In response to

Responses

pgsql-hackers by date

Next:From: The Hermit HackerDate: 1998-05-20 14:50:11
Subject: Re: [HACKERS] sorting big tables :(
Previous:From: Bruce MomjianDate: 1998-05-20 14:22:15
Subject: Re: [HACKERS] sorting big tables :(

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group