Condition with support or without support


Hi gurus

I wonder if someone can tell me the difference between the below 2 queries. I use the first query without media and other media.

Without media query

WITH DATA AS

(

SELECT Employee_id 100, 10 Minimum_age, 25 double Maximum_age

UNION ALL

SELECT Employee_id 200, 10 Minimum_age, 25 double Maximum_age

UNION ALL

SELECT Employee_id 300, Minimum_age, 25-Maximum_age double-2

UNION ALL

SELECT Employee_id 400, 10 Minimum_age, 5 Maximum_age OF double

)

SELECT * FROM DATA

WHERE < 0 minimum_age

or maximum_age < minimum_age;.

-------------------------

With query support

WITH DATA AS

(

SELECT Employee_id 100, 10 Minimum_age, 25 double Maximum_age

UNION ALL

SELECT Employee_id 200, 10 Minimum_age, 25 double Maximum_age

UNION ALL

SELECT Employee_id 300, Minimum_age, 25-Maximum_age double-2

UNION ALL

SELECT Employee_id 400, 10 Minimum_age, 5 Maximum_age OF double

)

SELECT * FROM DATA

WHERE (minimum_age < 0

or maximum_age, minimum_age);

--------------

If you see my time question in my first request I have use support in my where clause but in my second query I use support in my where clause. In my actual database, I have thousands of documents and when I turn off support then the query to run very quickly, otherwise it takes too long. Please explain the difference between the two... Really appreciate your advice. Thank you

Concerning

Shu

Hello

The reason why the second way may be faster, is the data in the memory cache, so that the system does not need to do a disk access relatively slow to read the table.

If you have other problems in the WHERE clause, parentheses may change the results.

If you are unsure if the parentheses are necessary or not, then use them to make sure that you get the desired results.  Once more, he won't be slower.

Tags: Database

Similar Questions

Maybe you are looking for