Got a request from dotnet spider user regarding query performance. In the below query, which one is best?
- select * from table1 where id in (select id from table2)
- select a.* from table1 a,table2 b where a.id=b.id
- Subqueries are usually slower when compared to the ordinary SQL queries.
- Two seperate execution happens in the first query, first the subquery will execute to fetch the data from table2, second the comparison with the data from the table1 happens to obtain the exact output.
Regards,
Venkatesan Prabu . J
No comments:
Post a Comment