I have a statement similar to ;
SELECT tableA A, tableB B, tableC C
WHERE a.ID = b.ID and
C.level = '2'
If i perform
SELECT tableA A, tableB B, tableC C
WHERE a.ID = b.ID and
My results are returned in 33 seconds. If i perform the original query the results are returned in 150 seconds. Why does C.level = '2' make it slower?
If you look at Oracle’s execution plan, you’ll see what it’s doing under-the-hood. However, to summarise, my guess is that your logic is:
However, for the database engine, it now has to go through the data and check each record to see if it matches your more complicated condition. How it does this is determined by your schema. For example, if you have an index on
c.level, that may make the performance difference negligible.