Re: vacuum analyze slows sql query - Mailing list pgsql-performance

From Gaetano Mendola
Subject Re: vacuum analyze slows sql query
Date
Msg-id 41931CCC.6070803@bigfoot.com
Whole thread Raw
In response to Re: vacuum analyze slows sql query  (patrick ~ <sidsrr@yahoo.com>)
List pgsql-performance
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






pgsql-performance by date:

Previous
From: "Steinar H. Gunderson"
Date:
Subject: Re: How to speed-up inserts with jdbc
Next
From: Allen Landsidel
Date:
Subject: Re: Strange (?) Index behavior?