2

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?

2
  • it's not truly JOIN, this approach is more slower as JOIN you can use select a.field1, b.field1, b.field2 from table_a a inner join table_b b where a.field2 = b.field3 Commented Jun 3, 2012 at 18:42
  • So you mean that the 'join...on' would give the same result? Commented Jun 3, 2012 at 18:51

2 Answers 2

1

MySQL does not cope with having no indexes. Oracle can do a hash join and still be fast. Add indexes on the join columns.

Sign up to request clarification or add additional context in comments.

Comments

0

You need indexes in MySql to avoid the problem that you are facing.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.