Slide 19
Slide 19 text
実行計画(サブクエリ部のみ)
PostgreSQL11
-> Index Scan using idx_113458_enabled_modules_project_id on enabled_modules em (cost=0.28..1.31 rows=1 width=8)
Index Cond: (project_id = wikis.project_id)
Filter: ((name)::text = 'wiki'::text)
MariaDB10
+------+--------------+-------------+--------+----------------------------+--------------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+--------------+-------------+--------+----------------------------+--------------+---------+------+------+-------------+
| 1 | PRIMARY | | eq_ref | distinct_key | distinct_key | 4 | func | 1 | |
| 2 | MATERIALIZED | em | ALL | enabled_modules_project_id | NULL | NULL | NULL | 3499 | Using where |
+------+--------------+-------------+--------+----------------------------+--------------+---------+------+------+-------------+
キーを使用せず、行数がふくれる
→MySQL8でも実行計画は変わらず
メインテーブルのキーを使用