devxlogo

WHERE Clause and Query Performance

WHERE Clause and Query Performance

Question:
As a rule of thumb, a query that does a join will run faster if the table with the least number of rows is referenced first in the FROM-clause and if appropriate indicies are created. Under what circumstances can the performance of a query be improved by transposing or re-ordering the content of the WHERE-clause?

Answer:
My understanding was that these order-dependent shortcuts or advantages were laid to rest by the SQL 7 optimiser. From what I read on the list servers and mail groups, people who make a living tuning are finding their opportunities to improve performance in the nics and wires more easily than by trying to outguess the optimiser. My guess is that there are other areas to consider for speed improvements besides the order of the WHERE clause, for example the datatypes used and their order in the construction of the index, where I think you can obtain more bang for the buck in the quest for performance.

See also  5 Ways to Improve Customer Experience
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist