IN or EXISTS?? faster one
От | Prachi Jain |
---|---|
Тема | IN or EXISTS?? faster one |
Дата | |
Msg-id | 20021219130947.8489.qmail@webmail28.rediffmail.com обсуждение исходный текст |
Ответы |
Re: IN or EXISTS?? faster one
Re: IN or EXISTS?? faster one |
Список | pgsql-general |
Hello All, I am using too many subqueries in my queries. I have read some FAQs that using EXISTS is faster than IN. Is that correct?? I tried to get the total runtime using EXPLAIN ANALYZE, but i got total runtime for the query with IN but not for the query with EXISTS. query with IN: EXPLAIN ANALYZE Select * from bom where depot_id in ( SELECT depot_id from depot where company_name ='SOME' ); query with EXISTS: EXPLAIN ANALYZE Select * from bom WHERE EXISTS ( SELECT depot_id from depot where company_name ='SOME' and depot.depot_id = bom.depot_id ); I read the same for using with select count(*)...is too slow. How to replace for that?? Moreover, what are the other things one should take care of regarding reducing the time taken by the queries?? Thanks in advance. Regards Prachi
В списке pgsql-general по дате отправления: