devxlogo

SQL Query Optimizing Tips

SQL Query Optimizing Tips

Question:
I just wanted to know if you could share some techniques on how to optimize SQL queries (for example, inner join first before performing some steps, do not use computations, etc.).

Answer:
Since this borders on a black art, the only advice I can offer is this: depending on how you are running these, use ODBC trace to trace the output of the query and, if you can, use showplan to see how the optimizer handles your request, and go from there.

There may be a zillion ways to improve performance, from creating an index to dropping one, or from changing datatypes. How about floats for auto-incrementing primary keys? (Just Kidding!)

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