
Trending @Accenture; Snowflake SQL Query
Which query runs faster and will not run on loop like a long running query?
- Using inner query such as select abc from tbl where abc in (select distinct abc from bcd);
- select abc from tbl join select distinct abc from bcd on tbl.abc = bcd.abc

Hi @IntelligentNightgown75 I think 2nd query will run faster
Query 1 - Here subquery will be executed first then results of sub-query used by in predicate and will iterate over TBL and compare every row value of abc with the values returned by sub-query.
Query 2- Here Cartesian join will take place between distinct abc values and table join, hence no explicit filter will be applied instead at time of joining only filter will happen automatically

I don't really know the correct answer but when I was doing java projects all hibernate queries having multiple tables(more than 5) were advised to be done using joins rather than inner query. I think more complex queries should be done using joins. So from my exp joins should be faster.

Chutti hai yaar chodh de ye sab