Alex Rivera | Logout

Execution order of conditions in SQL 'where' clause

Asked 2008-12-04T10:26:10.973
22

I have a set of conditions in my where clause like

WHERE 
d.attribute3 = 'abcd*'  
AND x.STATUS != 'P' 
AND x.STATUS != 'J' 
AND x.STATUS != 'X' 
AND x.STATUS != 'S' 
AND x.STATUS != 'D' 
AND CURRENT_TIMESTAMP - 1 < x.CREATION_TIMESTAMP

Which of these conditions will be executed first? I am using oracle.

Will I get these details in my execution plan? (I do not have the authority to do that in the db here, else I would have tried)

Edit
Report

1 Answer

8

The database will decide what order to execute the conditions in.

Normally (but not always) it will use an index first where possible.

answered 2008-12-04T10:28:53.107

Your Answer