Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id C8C491337BC8 for ; Wed, 23 Mar 2011 07:05:21 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 93875-09 for ; Wed, 23 Mar 2011 10:05:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp120.dfw.emailsrvr.com (smtp120.dfw.emailsrvr.com [67.192.241.120]) by mail.postgresql.org (Postfix) with ESMTP id 5C74B1337BBB for ; Wed, 23 Mar 2011 07:05:13 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 5AD222A8149; Wed, 23 Mar 2011 06:05:13 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp2.relay.dfw1a.emailsrvr.com (Authenticated sender: adarsh.sharma-AT-orkash.com) with ESMTPSA id ACE322A8116; Wed, 23 Mar 2011 06:05:11 -0400 (EDT) Message-ID: <4D89C704.5080603@orkash.com> Date: Wed, 23 Mar 2011 15:40:12 +0530 From: Adarsh Sharma User-Agent: Thunderbird 2.0.0.22 (X11/20090625) MIME-Version: 1.0 To: Vitalii Tymchyshyn CC: pgsql-performance@postgresql.org Subject: Re: Re-Reason of Slowness of Query References: <4D89BABF.4080806@orkash.com> <4D89BCD6.6040604@gmail.com> In-Reply-To: <4D89BCD6.6040604@gmail.com> Content-Type: multipart/alternative; boundary="------------090409000904070002010408" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7 X-Spam-Level: X-Archive-Number: 201103/262 X-Sequence-Number: 42941 This is a multi-part message in MIME format. --------------090409000904070002010408 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit I just want to retrieve that id 's from page_content which do not have any entry in clause2 table. Thanks , Adarsh Vitalii Tymchyshyn wrote: > 23.03.11 11:17, Adarsh Sharma ???????(??): >> >> I think it is very much faster but I don't understand the query : >> >> *explain select distinct(b) from t1,t2 where t1.b >t2.d union all >> select distinct(b) from t1,t2 where t1.b > * > I don't understand it too. What are you trying to get? Is it > select distinct(b) from t1 where b > (select min(d) from t2)* *or b > < (select max(d) from t2) > ? > > Can you explain in words, not SQL, what do you expect do retrieve? > > Best regards, Vitalii Tymchyshyn --------------090409000904070002010408 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I just want to retrieve that id 's from page_content which do not have any entry in clause2 table.

Thanks , Adarsh

Vitalii Tymchyshyn wrote:
23.03.11 11:17, Adarsh Sharma написав(ла):

I think it is very much faster but I don't understand the query :

explain select distinct(b) from t1,t2 where t1.b >t2.d union all  select distinct(b) from t1,t2 where  t1.b <t2.d;

I don't understand it too. What are you trying to get? Is it
select distinct(b) from t1 where  b > (select min(d) from t2) or b  < (select max(d) from t2)
?

Can you explain in words, not SQL, what do you expect do retrieve?

Best regards, Vitalii Tymchyshyn

--------------090409000904070002010408--