2019 Sep 26 4:10 PM
Dear experts,
I want to know on which priority order filters were applied in a query.
Let's say a query with 4 conditions in where clause. In which order these were processed.
Is it, first filter rows using 1st condition col1 = value1, on this result set apply 2nd filter and so on...
select column1, column2 from my_table where col1 = value1 and col2 = value2 and col3 = value 3 and col4 = value4
Dear experts,
I want to know on which priority order filters were applied in a query.
Let's say a query with 4 conditions in where clause. In which order these were processed.
Is it, first filter rows using 1st condition col1 = value1, on this result set apply 2nd filter and so on...
select column1, column2 from my_table where col1 = value1 and col2 = value2 and col3 = value 3 and col4 = value4
2019 Oct 10 4:39 AM
Hi Naveen,
SQL optimizer decides which condition retrive least number of records. Accordingly, it decides the order of filters to be processed. If you want enforce the order of execution of filters then you can use sub query of use filters within brackets.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |