pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gaetano Mendola <mendola@bigfoot.com>
To: patrick ~ <sidsrr@yahoo.com>
Subject: Re: vacuum analyze slows sql query
Date: Thu, 11 Nov 2004 09:03:24 +0100
Message-ID: <41931CCC.6070803@bigfoot.com> (raw)
In-Reply-To: <20041109192644.6423.qmail@web52104.mail.yahoo.com>
References: <419008DA.3000007@johnmeinel.com>
	<20041109192644.6423.qmail@web52104.mail.yahoo.com>

patrick ~ wrote:
> --- John Meinel <john@johnmeinel.com> wrote:
> 
> 
>>If you are trying to establish existence, we also had a whole thread on 
>>this. Basically what we found was that adding an ORDER BY clause, helped 
>>tremendously in getting the planner to switch to an Index scan. You 
>>might try something like:
>>
>>SELECT column FROM mytable WHERE column='myval' ORDER BY column LIMIT 1;
>>
>>There seems to be a big difference between the above statement and:
>>
>>SELECT column FROM mytable WHERE column='myval' LIMIT 1;
> 
> 
> 
> The ORDER BY "trick" worked beautifully!  I just hope it'll
> continue to work consistently in production code.

For sure it will not break the goal: "check the existence".



Regards
Gaetano Mendola








view thread (17+ messages)

Message-ID: <41931CCC.6070803@bigfoot.com>
Permalink:  ../41931CCC.6070803@bigfoot.com/
Also on:    postgresql.org/message-id/41931CCC.6070803@bigfoot.com

 · 

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: mendola@bigfoot.com, sidsrr@yahoo.com
  Subject: Re: vacuum analyze slows sql query
  In-Reply-To: <41931CCC.6070803@bigfoot.com>

* 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