Reputation: 2291
My manger just told me that having joins or where clause in oracle query doesn't affect performance even when you have million records in each table. And I am just not satisfied with this and want to confirm that.
which of the following queries is better in performance on oracle and in postgresql also
1-
select a.name,b.salary,c.address from a,b,c where a.id=b.id and a.id=c.id;
2-
select a.name,b.salary,c.address from a JOIN b on a.id=b.id JOIN C on a.id=c.id;
I have tried Explain in postgresql for a small data set and query time was same (may be because I have just few rows) and right now I have no access to oracle and actual database to analyze the Explain in real envoirnment.
Upvotes: 1
Views: 207
Reputation: 7189
Using JOINS
makes the code easier to read, since it's self-explanatory.
In speed there is no difference (I have just tested it) and the execution plan is the same
If the query optimizer is doing its job right, there should be no difference between those queries. They are just two ways to specify the same desired result.
Upvotes: 3