BUG #1393: Adding 'LIMIT 1' to the query halts forever if no data present

From: "Fahad" <Fahad(dot)Gilani(at)anusf(dot)anu(dot)edu(dot)au>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1393: Adding 'LIMIT 1' to the query halts forever if no data present
Date: 2005-01-12 23:08:55
Message-ID: 200501122308.j0CN8tbc025002@developer.pgadmin.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 1393
Logged by: Fahad
Email address: Fahad(dot)Gilani(at)anusf(dot)anu(dot)edu(dot)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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message John R Pierce 2005-01-12 23:32:06 Re: psql: no chance to enter password in certain situations
Previous Message Christoph Becker 2005-01-12 23:03:01 Re: rc4 and rc3, some deleted, but still needed text in the