Re: PostgreSQL 8.3.3 chooses wrong query plan when LIMIT 1 added?

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Mark Cave-Ayland <mark(dot)cave-ayland(at)siriusit(dot)co(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PostgreSQL 8.3.3 chooses wrong query plan when LIMIT 1 added?
Date: 2008-10-27 19:24:29
Message-ID: 1225135469.3971.94.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Angel Alvarez 2008-10-27 19:45:20 Re: nearest neighbor search from xyz coordinates
Previous Message Sam Mason 2008-10-27 19:16:34 Re: empty table explain...