Reputation: 145
Given the following join in Oracle Pl/SQL:
select a.field1, b.field1, b.field2
from table_a a, table_b b
where a.field2 = b.field3;
When executed this code in MySQL, it takes a really long time to do the task while in Pl/SQL it takes no time. The tables are the same in the two environments. No fields are indexed.
Is there a difference between the joins in the two dialects? What would be the correct translation of this in standard SQL?
Upvotes: 2
Views: 420
Reputation: 171178
MySQL does not cope with having no indexes. Oracle can do a hash join and still be fast. Add indexes on the join columns.
Upvotes: 1