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

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 (view raw or flat)
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

pgsql-bugs by date

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

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