4 ms·
I have to say, I don't understand your join in the first example. In my head, key1 was the primary key. In the second example, if key1 is unique and the databa
by pradocchia 17y ago
I have to say, I don't understand your join in the first example. In my head, key1 was the primary key.
In the second example, if key1 is unique and the database knows it, the optimizer should be able to determine that c returns no records, and therefore the outer query returns no records as well. It bypasses execution entirely, thus 0.00 sec.
If key1 is not unique, or it is unique but the database doesn't know about it, that is impressive.
- ars 17y agoIf key1 is the primary key then how can you have duplicates of it? By definition it's not a unique key, and c does return records.
- pradocchia 17y agoof course. i wasn't certain from context that you were running it against an non-primary key.