Re: PostgreSQL 8.3.3 chooses wrong query plan when LIMIT 1 added? - Mailing list pgsql-general

From Simon Riggs
Subject Re: PostgreSQL 8.3.3 chooses wrong query plan when LIMIT 1 added?
Date
Msg-id 1225135469.3971.94.camel@ebony.2ndQuadrant
Whole thread Raw
In response to PostgreSQL 8.3.3 chooses wrong query plan when LIMIT 1 added?  (Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>)
List pgsql-general
On Mon, 2008-10-27 at 16:39 +0000, Mark Cave-Ayland wrote:

> I'm experiencing a strange issue with PostgreSQL 8.3.3 whereby adding
> "LIMIT 1" to the query increases the query time from several 10s of ms
> to over 5s, and was wondering if anyone with more planner-fu can shed
> some light on this.

Sounds like one for the performance list.

LIMIT prevents the planner from transforming subselects. Maybe you want
EXISTS.

--
 Simon Riggs           www.2ndQuadrant.com
 PostgreSQL Training, Services and Support


pgsql-general by date:

Previous
From: Sam Mason
Date:
Subject: Re: empty table explain...
Next
From: Angel Alvarez
Date:
Subject: Re: nearest neighbor search from xyz coordinates