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

What are character functions in sql?

498


What is the difference between delete and truncate statement in sql?

499


how many columns can be used for creating index? : Sql dba

523


Do foreign keys improve performance?

549


Why do we need cursor in pl sql?

651






What are different joins used in sql?

556


What is time based sql injection?

490


What is a clob in sql?

569


How to move files from one directory to another in pl sql?

642


How do I run a sql query?

532


What is where clause in sql?

537


Which table is left in join?

516


Which language is used in sql?

521


What is a dirty read sql?

487


What does pragma mean?

511