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: andreas(dot)zeugswetter(at)telecom(dot)at (Andreas Zeugswetter)
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] sorting big tables :(
Date: 1998-05-22 14:24:20
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
> > 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.
> I think a real winner would be to use an existing index. This is what others do
> to eliminate a sort completely. Of course the optimizer has to choose what is cheaper 
> on a per query basis (index access or sort of result set).
> result set small --> use sort
> result set large --> use available index

Keep in mind an index is going to be seeking all over the table, making
the cache of limited use.  Sometime, when doing a join, the optimizer
chooses a sequential scan rather than use an index for this reason, and
the sequential scan is faster.

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

pgsql-hackers by date

Next:From: The Hermit HackerDate: 1998-05-22 14:45:10
Subject: Re: [GENERAL] error messages not only English
Previous:From: Bruce MomjianDate: 1998-05-22 14:20:45
Subject: Re: [GENERAL] error messages not only English

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