patrick ~ wrote:
--- John Meinel <[EMAIL PROTECTED]> 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






---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly

Reply via email to