[前][次][番号順一覧][スレッド一覧]

mysql:15943

From: Etsuo SUMIYA <Etsuo SUMIYA <sumiya-e@xxxxxxxxxx>>
Date: Wed, 27 Feb 2013 17:14:21 +0900 (LMT)
Subject: [mysql 15943] Re: mysql-5.6.9 vs mysql-5.1.68

sumiyaといいます。別件で時間がとれませんでした。

From: HIRATSUKA Sadao <hiratsuka.sadao@xxxxxxxxxx>
Subject: [mysql 15940] Re: mysql-5.6.9 vs mysql-5.1.68
Date: Thu, 21 Feb 2013 09:51:01 +0900
Message-ID: <20130221095100.B1B3.C8FC6C14@xxxxxxxxxx>


5.6系のmysqlのバージョンは5.6.10でした。申し訳ありませんでした。
その後、調査したところ、'set names'が影響しているということがわか
りました。

--- ここから 
mysql> set names sjis;
Query OK, 0 rows affected (0.00 sec)

mysql> explain select name,tm,v from t2 where name='n1' and tm<='20:05:00';
+----+-------------+-------+------+---------------+------+---------+-------+----
--+-----------------------+
| id | select_type | table | type | possible_keys | key  | key_len | ref   | row
s | Extra                 |
+----+-------------+-------+------+---------------+------+---------+-------+----
--+-----------------------+
|  1 | SIMPLE      | t2    | ref  | ix            | ix   | 67      | const |   1
0 | Using index condition |
+----+-------------+-------+------+---------------+------+---------+-------+----
--+-----------------------+
1 row in set (0.00 sec)

mysql> set names latin1;
Query OK, 0 rows affected (0.00 sec)

mysql> explain select name,tm,v from t2 where name='n1' and tm<='20:05:00';
+----+-------------+-------+------+---------------+------+---------+-------+----
--+-----------------------+
| id | select_type | table | type | possible_keys | key  | key_len | ref   | row
s | Extra                 |
+----+-------------+-------+------+---------------+------+---------+-------+----
--+-----------------------+
|  1 | SIMPLE      | t2    | ref  | ix            | ix   | 67      | const |
2 | Using index condition |
+----+-------------+-------+------+---------------+------+---------+-------+----
--+-----------------------+
1 row in set (0.00 sec)

mysql>
--- ここまで

実際のレコード数は

mysql> select count(*) from t4;
+----------+
| count(*) |
+----------+
|  3570024 |
+----------+
1 row in set (0.00 sec)

あります。

mysql> set names sjis;
Query OK, 0 rows affected (0.00 sec)

mysql> queryの実行。
:
50 rows in set (3.23 sec)

mysql> set names latin1;
Query OK, 0 rows affected (0.00 sec)

mysql> queryの実行。
:
50 rows in set (0.01 sec)

となります。

また、以下のサンプルではqueryの結果が正しくありません。

--- ここから
mysql> set names sjis;
Query OK, 0 rows affected (0.00 sec)

mysql> select name,tm,v from t2 where name='n1' and tm<='20:5:0';
+------+----------+------+
| name | tm       | v    |
+------+----------+------+
| n1   | 20:00:00 | v1   |
| n1   | 20:01:00 | v1   |
| n1   | 20:02:00 | v1   |
| n1   | 20:03:00 | v1   |
| n1   | 20:04:00 | v1   |
| n1   | 20:05:00 | v1   |
| n1   | 20:06:00 | v1   |
| n1   | 20:07:00 | v1   |
| n1   | 20:08:00 | v1   |
| n1   | 20:09:00 | v1   |
| n1   | 20:10:00 | v1   |
+------+----------+------+
11 rows in set (0.00 sec)

mysql> set names latin1;
Query OK, 0 rows affected (0.00 sec)

mysql> select name,tm,v from t2 where name='n1' and tm<='20:5:0';
+------+----------+------+
| name | tm       | v    |
+------+----------+------+
| n1   | 20:00:00 | v1   |
| n1   | 20:01:00 | v1   |
| n1   | 20:02:00 | v1   |
| n1   | 20:03:00 | v1   |
| n1   | 20:04:00 | v1   |
| n1   | 20:05:00 | v1   |
+------+----------+------+
6 rows in set (0.00 sec)

mysql>

--- ここまで

[前][次][番号順一覧][スレッド一覧]

     15935 2013-02-19 17:49 [Etsuo SUMIYA <sumiya] mysql-5.6.9 vs mysql-5.1.68             
     15938 2013-02-20 23:10 ┗[とみたまさひろ <tomm]                                       
   @ 15939 2013-02-21 00:19  ┗["yoku ts." <yoku0825]                                     
     15940 2013-02-21 09:51   ┗[HIRATSUKA Sadao <hir]                                   
->   15943 2013-02-27 17:14    ┗[Etsuo SUMIYA <sumiya]                                 
     15944 2013-02-27 23:21     ┗["yoku ts." <yoku0825]                               
     15946 2013-02-28 18:10      ┗[Etsuo SUMIYA <sumiya]                             
     15947 2013-02-28 18:35       ┗["yoku ts." <yoku0825]                           
     15948 2013-03-01 11:45        ┗["yoku ts." <yoku0825]