From: | Gaetano Mendola <mendola(at)bigfoot(dot)com> |
---|---|
To: | patrick ~ <sidsrr(at)yahoo(dot)com> |
Subject: | Re: vacuum analyze slows sql query |
Date: | 2004-11-11 08:03:24 |
Message-ID: | 41931CCC.6070803@bigfoot.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
patrick ~ wrote:
> --- John Meinel <john(at)johnmeinel(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Edwin Eyan Moragas | 2004-11-11 08:04:06 | Re: How to speed-up inserts with jdbc |
Previous Message | Gaetano Mendola | 2004-11-11 07:58:27 | Re: seqscan strikes again |