MySQL Query Optimization, Interpreting EXPLAIN Results

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: MySQL Query Optimization, Interpreting EXPLAIN Results

Post by Eran »

Since neither is using an index, it's hard to tell with such a small amount of rows. Try generating some mock data (about 100k rows or whatever you think will be the likely size) and try profiling the queries then.

Also note that those queries aren't completely identical. If there are densities that exist in one table but not the other, they will not show on JOIN'ed query, but will show on the UNION'ed query. Depending on what you need, this might be the difference.
Post Reply