質問編集履歴
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,6 +30,38 @@
|
|
30
30
|
|
31
31
|
|
32
32
|
|
33
|
+
mysql> show index from Customer; +----------+------------+-------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
|
34
|
+
|
35
|
+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
|
36
|
+
|
37
|
+
+----------+------------+-------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
|
38
|
+
|
39
|
+
| Customer | 1 | simple_idx | 1 | Telephone | A | 46 | NULL | NULL | YES | BTREE | | |
|
40
|
+
|
41
|
+
| Customer | 1 | primary_idx | 1 | SID | A | 204 | NULL | NULL | | BTREE | | |
|
42
|
+
|
43
|
+
+----------+------------+-------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
|
44
|
+
|
45
|
+
2 rows in set (0.00 sec)
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
mysql> show index from Teletype;
|
52
|
+
|
53
|
+
+----------+------------+------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
|
54
|
+
|
55
|
+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
|
56
|
+
|
57
|
+
+----------+------------+------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
|
58
|
+
|
59
|
+
| Teletype | 1 | simple_idx | 1 | telephone | A | 12 | NULL | NULL | YES | BTREE | | |
|
60
|
+
|
61
|
+
+----------+------------+------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
|
62
|
+
|
63
|
+
1 row in set (0.00 sec)
|
64
|
+
|
33
65
|
|
34
66
|
|
35
67
|
上記コマンドをたたくと、CustomerテーブルのCustomerテーブルにインデックスは張っているにもかかわらず、上記のようにフルスキャンとなって応答に30秒以上(explain extendedを取り除いたクエリで)かかってしまいます。(出力される行数は38万件程度)
|
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -36,4 +36,4 @@
|
|
36
36
|
|
37
37
|
|
38
38
|
|
39
|
-
indexを
|
39
|
+
indexを効かせる方法を教えてください。
|
1
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
|
34
34
|
|
35
|
-
上記コマンドをたたくと、CustomerテーブルのCustomerテーブルにインデックスは張っているにもかかわらず、上記のようにフルスキャンとなって応答に30秒以上(explain
|
35
|
+
上記コマンドをたたくと、CustomerテーブルのCustomerテーブルにインデックスは張っているにもかかわらず、上記のようにフルスキャンとなって応答に30秒以上(explain extendedを取り除いたクエリで)かかってしまいます。(出力される行数は38万件程度)
|
36
36
|
|
37
37
|
|
38
38
|
|