View Single Post

   
  #1 (permalink)  
Old 04-10-2008, 08:26 AM
Fahad
 
Posts: n/a
Default BUG #1393: Adding 'LIMIT 1' to the query halts forever if no data present


The following bug has been logged online:

Bug reference: 1393
Logged by: Fahad
Email address: Fahad.Gilani@anusf.anu.edu.au
PostgreSQL version: 8.0.0rc2
Operating system: Linux
Description: Adding 'LIMIT 1' to the query halts forever if no data
present
Details:

Hi,

In an empty table, if I do this:

"SELECT some_field WHERE some_field = 45 ORDER BY time";

This returns instantly with no results. However, doing the following takes
forever to return:

"SELECT some_field WHERE some_field = 45 ORDER BY time LIMIT 1";

It's a pain because my application is pretty generic and does not know
beforehand whether 'some_field' with ID 45 exists or not OR whether the
table has been wiped out clean. Why does it take so long for this query to
return?


Fahad

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply With Quote