2

Some of my coworkers make a point of ordering the conditions in Oracle SQL statements according to their understanding of the database and the presence of indices.

This answer dismisses the importance of sequence, while this answer has a comment that disagrees as far as PROLOG is concerned.

Okay, so ANSI SQL is really declarative and sequence is irrelevant. How about Oracle 11?

Community
  • 1
  • 1
Torben Gundtofte-Bruun
  • 2,104
  • 1
  • 24
  • 34

1 Answers1

5

Unless you're still using the old rule-based optimizer (and since you've tagged your question oracle11g, you most definitely aren't), reordering the WHERE clauses makes virtually no difference.

Note my use of the term virtually because - according to AskTom - they might still generate different execution plans if there are several operations that have the same estimated cost. But in practice, I'd consider it completely unnecessary to re-order the conditions in a SQL statement for performance reasons (it might still make sense to re-order them to make the statement more intelligible, of course).

Frank Schmitt
  • 30,195
  • 12
  • 73
  • 107