Skip site navigation (1) Skip section navigation (2)

BUG #2381: LIMIT 1 very very lazy than without

From: "Peter Krauss" <krauss(at)i-node(dot)com(dot)br>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2381: LIMIT 1 very very lazy than without
Date: 2006-04-06 22:50:49
Message-ID: 200604062250.k36MonFr099690@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      2381
Logged by:          Peter Krauss
Email address:      krauss(at)i-node(dot)com(dot)br
PostgreSQL version: 7.4
Operating system:   Linux
Description:        LIMIT 1 very very lazy than without
Details: 

The single query (on psql) is fary fast 
(less than 1 sec)

 SELECT a,b,c,d FROM products_view WHERE
 sku='0-123-0-0-6024-20'
 OR lower(codfornecedor)=lower('0-123-0-0-6024-20')
 OR lower(eanfor)=lower('0-123-0-0-6024-20')
 OR lower(refprodfornecedor)=lower('0-123-0-0-6024-20');
 -- ~0.1 second

BUT, IF I ADD a "LIMIT 1", it consumes 2 minutes!

 SELECT a,b,c,d FROM products_view WHERE
 sku='0-123-0-0-6024-20'
 OR lower(codfornecedor)=lower('0-123-0-0-6024-20')
 OR lower(eanfor)=lower('0-123-0-0-6024-20')
 OR lower(refprodfornecedor)=lower('0-123-0-0-6024-20') 
 LIMIT 1;
-- ~ 2 minutes !!

Responses

pgsql-bugs by date

Next:From: Philip WarnerDate: 2006-04-07 01:56:37
Subject: Re: BUG #2379: Duplicate pkeys in table
Previous:From: Stephan SzaboDate: 2006-04-06 21:56:25
Subject: Re: BUG #2377: pg_constraint didnt't updated when table

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group