Open the query analyzer and select "show Execution Plan", "Show server trace", and "show Customer statistics" in the query menu.
In the editing window, enter the SQL statement to be compared, for example, different query methods:
Select *
From crm_fwd
Where RQ between '2017-06-01 'and '2017-06-02'
Select *
From crm_fwd
Where datediff (day, RQ, '2017-06-01 ') = 0
After the two SQL statements are run, the returned result sets are the same.
The execution plan pane shows that the cost of the first query is 6.72%, and that of the second is 93.28%. The second query has been used before. A beautiful colleague mm reminded me to realize this efficiency problem. We can also compare the index efficiency in this way.
If you need more detailed information, you can view the trace and Statistics pane. In the Execution Plan pane, place the cursor over the icon of each step, and the corresponding operation information is displayed.