pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Yves Vindevogel <yves.vindevogel@implements.be>
Cc: pgsql-performance@postgresql.org
Subject: Re: Limit clause not using index
Date: Tue, 21 Jun 2005 10:42:53 -0400
Message-ID: <3415.1119364973@sss.pgh.pa.us> (raw)
In-Reply-To: <d0da86521cd54473cac40df63bb14546@implements.be>
References: <d0da86521cd54473cac40df63bb14546@implements.be>

Yves Vindevogel <yves.vindevogel@implements.be> writes:
> Can anyone explain me this ?

> rvponp=# explain select * from tblprintjobs order by loginuser,  
> desceventdate, desceventtime offset 25 limit 25 ;
>                                      QUERY PLAN
> ------------------------------------------------------------------------ 
> -----------
>   Limit  (cost=349860.62..349860.68 rows=25 width=206)
>     ->  Sort  (cost=349860.56..351416.15 rows=622236 width=206)
>           Sort Key: loginuser, desceventdate, desceventtime
>           ->  Seq Scan on tblprintjobs  (cost=0.00..25589.36 rows=622236 width=206)
> (4 rows)


Do you have an index matching that sort key?  I'd certainly expect the
above to use it if it were there.  For the full table case it's not so
clear --- an indexscan isn't always better.

			regards, tom lane



view thread (14+ messages)  latest in thread

Message-ID: <3415.1119364973@sss.pgh.pa.us>
Permalink:  ../3415.1119364973@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3415.1119364973@sss.pgh.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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, yves.vindevogel@implements.be
  Subject: Re: Limit clause not using index
  In-Reply-To: <3415.1119364973@sss.pgh.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