Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
22
Help us understand the problem. What is going on with this article?
@yoshiokatsuneo@github

MySQLでのサブクエリ、inner joinのパフォーマンス比較

More than 5 years have passed since last update.

MySQLでサブクエリを作ると非常に遅くなることがあります。これは、外部クエリが評価された後、内部クエリが評価されるためです。
Inner Joinの場合、最適化されて遅くはなりません。

実際比較を行ってみた結果です。

256件のデータで
INNER JOIN: 0.002秒
サブクエリ: 0.348秒
と大きな違いがありました。

実行可能コード: https://paiza.io/projects/WmL_8SwUE-0G3Yx0KcJR4A

スクリーンショット 2014-12-19 午後4.56.51.png

22
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
yoshiokatsuneo@github
A software engineer

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
22
Help us understand the problem. What is going on with this article?