How do you optimize SQL queries ?

Answer Posted / hutashan

Avoid implicit datatype conversion
Avoid using function on an indexed column
Avoid comparing column value with NULL
Outer Join
Use OR carefully

Always use NOT EXISTS instead of NOT IN


Use UNION ALL whenever possible (no implicit sorts)
UNION will sort the result set for each SELECT before
combining the final result set
Remove DISTINCT keyword from SELECT if UNION is used

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is sql a backend?

545


What is date functions?

572


How do you write a complex sql query?

582


How do I remove duplicates in two columns?

506


What has stored procedures in sql and how we can use it?

561






Where can I learn sql for free?

500


What is sql and explain its components?

593


how to create a new table by selecting rows from another table in mysql? : Sql dba

558


How do you exit in sql?

585


How does index help in query performance?

558


When is the explicit cursor used ?

588


i have a column which may contain this kind of value: 123*67_80,12*8889_5,34*8_874 ,12*7_7 (can contain space before a comma, and this string length can be anything) now i want to split this value into two column like: column1: 123*67,12*8889,34*8,12*7 column2: 80,5,874,7 use function for this

1063


What are the advantages of sql?

556


What are sql functions? Describe in brief different types of sql functions?

484


How do I count rows in sql?

556