pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <maillist@candle.pha.pa.us>
To: taral@mail.utexas.edu
Cc: lockhart@alumni.caltech.edu
Cc: jwieck@debis.com
Cc: eric@linux-hw.com
Cc: jeff@remapcorp.com
Cc: hackers@postgreSQL.org
Subject: Re: [HACKERS] What about LIMIT in SELECT ?
Date: Wed, 14 Oct 1998 14:01:49 -0400 (EDT)
Message-ID: <199810141801.OAA29496@candle.pha.pa.us> (raw)
In-Reply-To: <000001bdf79b$e75d87e0$3b291f0a@taral>

[Charset iso-8859-1 unsupported, filtering to ASCII...]
> > Thomas is correct on this.  Vadim has run some tests, and with our
> > optimized psort() code, the in-memory sort is often faster than using
> > the index to get the tuple, because you are jumping all over the drive.
> > I don't remember, but obviously there is a break-even point where
> > getting X rows using the index on a table of Y rows is faster , but
> > getting X+1 rows on a table of Y rows is faster getting all the rows
> > sequentailly, and doing the sort.
> >
> > You would have to pick only certain queries(no joins, index matches
> > ORDER BY), take the number of rows requested, and the number of rows
> > selected, and figure out if it is faster to use the index, or a
> > sequential scan and do the ORDER BY yourself.
> 
> Since a sort loads the data into memory anyway, how about speeding up the
> sort by using the index? Or does that take up too much memory? (approx 40%
> more than the data alone, I think)

Not sure you can do that.  The index points to heap tuples/tids, and
though there are tids in the rows, you can't access them as tids in
memory.


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



view thread (60+ messages)  latest in thread

Message-ID: <199810141801.OAA29496@candle.pha.pa.us>
Permalink:  ../199810141801.OAA29496@candle.pha.pa.us/
Also on:    postgresql.org/message-id/199810141801.OAA29496@candle.pha.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: maillist@candle.pha.pa.us, taral@mail.utexas.edu, lockhart@alumni.caltech.edu, jwieck@debis.com, eric@linux-hw.com, jeff@remapcorp.com, hackers@postgreSQL.org
  Subject: Re: [HACKERS] What about LIMIT in SELECT ?
  In-Reply-To: <199810141801.OAA29496@candle.pha.pa.us>
  References: <000001bdf79b$e75d87e0$3b291f0a@taral> <199810141801.OAA29496@candle.pha.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox