Practice 1:
You can improve performance by avoiding joins altogether.Consider this SELECT:
SELECT COUNT (*) FROM Table1, Table2
WHERE Table1.column1 = Table2.column1
If Table1.column1 is unique, you could replace the join with a sub query.
Transform the SELECT to:
SELECT COUNT (*) FROM Table2
WHERE Table2.column1 IN
(SELECT Table1.column1 FROM Table1)
GAIN: 4/6
WARNING
Don't do this for Oracle; it shows a loss.
Practice 2:
You can improve performance by avoiding joins altogether.Consider this SELECT:
SELECT COUNT (*) FROM Table1, Table2
WHERE Table1.column1 = Table2.column1
If Table1.column1 is unique, you could replace the join with a sub query.
Transform the SELECT to:
SELECT COUNT (*) FROM Table2
WHERE Table2.column1 IN
(SELECT Table1.column1 FROM Table1)
GAIN: 4/6
WARNING
Don't do this for Oracle; it shows a loss.
Practice 2:
No comments:
Post a Comment