Re: BUG #2381: LIMIT 1 very very lazy than without

From: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2381: LIMIT 1 very very lazy than without
Date: 2006-04-10 03:02:19
Message-ID: e1ci2d$dfe$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


""Peter Krauss"" <krauss(at)i-node(dot)com(dot)br> wrote
>
> 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 !!
>

Can you post the \d of products_view and EXPLAIN ANALYZE results of these
two queries from psql?

Regards,
Qingqing

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Richard Huxton 2006-04-10 09:52:10 Re: BUG #2382: Fail ODBC Connection
Previous Message Tom Lane 2006-04-09 22:19:24 Re: BUG #2383: MessageBox Win32 API makes clients freeze