Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread Adarsh Sharma
t...@fuzzy.cz wrote: On 03/23/2011 04:17 AM, Adarsh Sharma wrote: explain analyze select distinct(p.crawled_page_id) from page_content p where NOT EXISTS (select 1 from clause2 c where c.source_id = p.crawled_page_id); You know... I'm surprised nobody has mentioned this, but DISTIN

Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread Shaun Thomas
On 03/23/2011 09:16 AM, t...@fuzzy.cz wrote: which means this is at least 8.4. Plus the 'distinct' step uses less than 1% of total time, so even if you improve it the impact will be minimal. Haha. Noted. I guess I'm still on my original crusade against DISTINCT. I was pulling it out of so muc

Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread tv
> On 03/23/2011 04:17 AM, Adarsh Sharma wrote: > >> explain analyze select distinct(p.crawled_page_id) from page_content >> p where NOT EXISTS (select 1 from clause2 c where c.source_id = >> p.crawled_page_id); > > You know... I'm surprised nobody has mentioned this, but DISTINCT is > very slow unl

Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread Shaun Thomas
On 03/23/2011 04:17 AM, Adarsh Sharma wrote: explain analyze select distinct(p.crawled_page_id) from page_content p where NOT EXISTS (select 1 from clause2 c where c.source_id = p.crawled_page_id); You know... I'm surprised nobody has mentioned this, but DISTINCT is very slow unless you have

Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread tv
> >> Actually the plans are equal, so I suppose it depends on what were >> run first :). Slow query operates with data mostly on disk, while >> fast one with data in memory. >> >> yeah. maybe the easiest way, is to start a fresh session and fire the >> queries. > > > After the fresh sta

Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread Adarsh Sharma
Actually the plans are equal, so I suppose it depends on what were run first :). Slow query operates with data mostly on disk, while fast one with data in memory. yeah. maybe the easiest way, is to start a fresh session and fire the queries. After the fresh start , the results o

Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread Adarsh Sharma
Vitalii Tymchyshyn wrote: 23.03.11 13:21, Adarsh Sharma ???(??): Thank U all, for U'r Nice Support. Let me Conclude the results, below results are obtained after finding the needed queries : *First Option : *pdc_uima=# explain analyze select distinct(p.crawled_page_id) from page_conten

Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread Chetan Suttraway
On Wed, Mar 23, 2011 at 4:51 PM, Vitalii Tymchyshyn wrote: > 23.03.11 13:21, Adarsh Sharma написав(ла): > > Thank U all, for U'r Nice Support. > > Let me Conclude the results, below results are obtained after finding the > needed queries : > > *First Option : > > *pdc_uima=# explain analyze selec

Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread Vitalii Tymchyshyn
23.03.11 13:21, Adarsh Sharma ???(??): Thank U all, for U'r Nice Support. Let me Conclude the results, below results are obtained after finding the needed queries : *First Option : *pdc_uima=# explain analyze select distinct(p.crawled_page_id) pdc_uima-# from page_content p left join cla

Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread Adarsh Sharma
Thank U all, for U'r Nice Support. Let me Conclude the results, below results are obtained after finding the needed queries : *First Option : *pdc_uima=# explain analyze select distinct(p.crawled_page_id) pdc_uima-# from page_content p left join clause2 c on (p.crawled_page_id = pdc_uima(# c.

Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread Chetan Suttraway
On Wed, Mar 23, 2011 at 4:08 PM, wrote: > > I just want to retrieve that id 's from page_content which do not have > > any entry in clause2 table. > > In that case the query probably does not work (at least the query you've > sent in the first post) as it will return even those IDs that have at >

Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread Chetan Suttraway
On Wed, Mar 23, 2011 at 3:49 PM, Adarsh Sharma wrote: > Vitalii Tymchyshyn wrote: > > 23.03.11 12:10, Adarsh Sharma написав(ла): > > I just want to retrieve that id 's from page_content which do not have any > entry in clause2 table. > > Then > select distinct(p.crawled_page_id) from page_conten

Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread tv
> I just want to retrieve that id 's from page_content which do not have > any entry in clause2 table. In that case the query probably does not work (at least the query you've sent in the first post) as it will return even those IDs that have at least one other row in 'clause2' (not matching the !

Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread Vitalii Tymchyshyn
23.03.11 12:19, Adarsh Sharma ???(??): Vitalii Tymchyshyn wrote: 23.03.11 12:10, Adarsh Sharma ???(??): I just want to retrieve that id 's from page_content which do not have any entry in clause2 table. Then select distinct(p.crawled_page_id) from page_content p where NOT EXISTS (se

Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread Adarsh Sharma
Vitalii Tymchyshyn wrote: 23.03.11 12:10, Adarsh Sharma ???(??): I just want to retrieve that id 's from page_content which do not have any entry in clause2 table. Then select distinct(p.crawled_page_id) from page_content p where NOT EXISTS (select 1 from clause2 c where c.source_id =

Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread Vitalii Tymchyshyn
23.03.11 12:10, Adarsh Sharma ???(??): I just want to retrieve that id 's from page_content which do not have any entry in clause2 table. Then select distinct(p.crawled_page_id) from page_content p where NOT EXISTS (select 1 from clause2 c where c.source_id = p.crawled_page_id); is cor

Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread Adarsh Sharma
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 wh

Re: [PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread Vitalii Tymchyshyn
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 dist

[PERFORM] Re-Reason of Slowness of Query

2011-03-23 Thread Adarsh Sharma
Thanks Chetan, After my Lunch Break, I tried the below steps : *My original query was : *explain analyze select distinct(p.crawled_page_id) from page_content p , clause2 c where p.crawled_page_id != c.source_id which hangs because it is wrong query to fetch the desired output . *Next Updated