# Inner joining big table

**URL:** <https://forums.percona.com/t/inner-joining-big-table/99>\
**Category:** Other MySQL® Questions\
**Created:** [October 10, 2006, 8:47am UTC](https://forums.percona.com/t/inner-joining-big-table/99 "2006-10-10T08:47:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zanzi](https://avatars.discourse-cdn.com/v4/letter/z/cdc98d/32.png) [@zanzi](https://forums.percona.com/u/zanzi)\
**Post date:** [October 10, 2006, 8:47am UTC](https://forums.percona.com/t/inner-joining-big-table/99/1 "2006-10-10T08:47:59Z")

</div>

Is there a difference if the table being joined is a big table? (compared to the other way around?)

select p.\*, f.notes FROM featured f INNER JOIN items p ON f.item\_id = p.id WHERE f.type = 0 ORDER BY f.created\_at DESC

select p.\*, f.notes FROM items p INNER JOIN featured f ON (f.item\_id = p.id AND f.type = 0) WHERE p.featured = 1 ORDER BY f.created\_at DESC

select p.\*, f.notes FROM items p INNER JOIN featured f ON (f.id = p.featured) WHERE p.featured != 0 ORDER BY f.created\_at DESC

Which of these queries would be the best? Is the WHERE clause only executed after the INNER JOIN has been done?

Sorry for these “noob” questions )

---

<div class="post-metadata">

**Author:** ![Peter](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/peter/32/2_2.png) [@Peter](https://forums.percona.com/u/Peter)\
**Post date:** [October 10, 2006, 8:54am UTC](https://forums.percona.com/t/inner-joining-big-table/99/2 "2006-10-10T08:54:06Z")

</div>

For Inner join it does not matter. I would probably use conceptual schema to split ON/WHERE clause - ie put foreign key in ON and extra filters in WHERE.

For LEFT JOIN it is different as as ON clause generates NULL rows in joined table if it is not matches, while WHERE clause works as normally filtering out rows which do not match it.
