datetime timestamp查询性能咨询
各位好:
有一个表,里面分别有2个时间类型的字段。
test_time | timestamp | NO | MUL | 0000-00-00 00:00:00 |
date_time | datetime | YES | MUL | 0000-00-00 00:00:00 |
分别建立了索引,可是查询的时候性能差别很大,求解释求优化
mysql> select count(1) from log_records_test where test_time between '2013/03/03 00:00:00' and '2014/08/08 00:00:00';
+----------+
| count(1) |
+----------+
| 544206 |
+----------+
1 row in set (0.97 sec)
----------------------------------------------------------------------------------------------------------------------------------------
mysql> select count(1) from log_records_test where date_time between '2013/03/03 00:00:00' and '2014/08/08 00:00:00';
+----------+
| count(1) |
+----------+
| 544206 |
+----------+
1 row in set (0.57 sec)