teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

修正

2015/06/07 16:42

投稿

imamoto_browser
imamoto_browser

スコア1161

title CHANGED
File without changes
body CHANGED
@@ -14,7 +14,23 @@
14
14
  +----+--------------+------------+------+---------------+------+---------+------+----------+----------+----------------------------------------------------+
15
15
  6 rows in set, 1 warning (0.44 sec)
16
16
 
17
+ mysql> show index from Customer; +----------+------------+-------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
18
+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
19
+ +----------+------------+-------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
20
+ | Customer | 1 | simple_idx | 1 | Telephone | A | 46 | NULL | NULL | YES | BTREE | | |
21
+ | Customer | 1 | primary_idx | 1 | SID | A | 204 | NULL | NULL | | BTREE | | |
22
+ +----------+------------+-------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
23
+ 2 rows in set (0.00 sec)
17
24
 
25
+
26
+ mysql> show index from Teletype;
27
+ +----------+------------+------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
28
+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
29
+ +----------+------------+------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
30
+ | Teletype | 1 | simple_idx | 1 | telephone | A | 12 | NULL | NULL | YES | BTREE | | |
31
+ +----------+------------+------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
32
+ 1 row in set (0.00 sec)
33
+
18
34
  上記コマンドをたたくと、CustomerテーブルのCustomerテーブルにインデックスは張っているにもかかわらず、上記のようにフルスキャンとなって応答に30秒以上(explain extendedを取り除いたクエリで)かかってしまいます。(出力される行数は38万件程度)
19
35
 
20
36
  indexを効かせる方法を教えてください。

2

修正

2015/06/07 16:41

投稿

imamoto_browser
imamoto_browser

スコア1161

title CHANGED
File without changes
body CHANGED
@@ -17,4 +17,4 @@
17
17
 
18
18
  上記コマンドをたたくと、CustomerテーブルのCustomerテーブルにインデックスは張っているにもかかわらず、上記のようにフルスキャンとなって応答に30秒以上(explain extendedを取り除いたクエリで)かかってしまいます。(出力される行数は38万件程度)
19
19
 
20
- indexをrefにする方法を教えてください。
20
+ indexを効かせる方法を教えてください。

1

修正

2015/06/07 16:40

投稿

imamoto_browser
imamoto_browser

スコア1161

title CHANGED
File without changes
body CHANGED
@@ -15,6 +15,6 @@
15
15
  6 rows in set, 1 warning (0.44 sec)
16
16
 
17
17
 
18
- 上記コマンドをたたくと、CustomerテーブルのCustomerテーブルにインデックスは張っているにもかかわらず、上記のようにフルスキャンとなって応答に30秒以上(explaind extendedを取り除いたクエリで)かかってしまいます。(出力される行数は38万件程度)
18
+ 上記コマンドをたたくと、CustomerテーブルのCustomerテーブルにインデックスは張っているにもかかわらず、上記のようにフルスキャンとなって応答に30秒以上(explain extendedを取り除いたクエリで)かかってしまいます。(出力される行数は38万件程度)
19
19
 
20
20
  indexをrefにする方法を教えてください。