Re: slow SELECT ... LIMIT query

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Simon Stanlake <stanlake(at)hi(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: slow SELECT ... LIMIT query
Date: 2001-07-19 01:55:56
Message-ID: 20010719115556.B1044@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jul 18, 2001 at 10:49:29AM -0700, Simon Stanlake wrote:
> Hi,
>
> I have a fairly large table (1 million records) with the following
> structure...
>
[snip]

Well, it's fai;rly hard to guess at questions like this unless you provide
some more details. Do you think you could post EXPLAIN outputs for both
queries?

> Is this common when you use the LIMIT clause? Is there a work around?

It shouldn't happen but something that might work is to create a cursor and
then do fetch 1;

--
Martijn van Oosterhout <kleptog(at)svana(dot)org>
http://svana.org/kleptog/
> It would be nice if someone came up with a certification system that
> actually separated those who can barely regurgitate what they crammed over
> the last few weeks from those who command secret ninja networking powers.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dr. Evil 2001-07-19 02:05:07 Re: pl-sql
Previous Message Tom Lane 2001-07-19 01:50:19 Re: RE: Intermittent Startup Failures