技术开发 频道

mysql特定时间运行速度变慢的问题一例

  再看看这个执行最慢的几个sql的执行计划: 

1 mysql>  explain select * from session where sky_id=112414853 \G;
2
3 *************************** 1. row ***************************
4
5 id: 1
6
7 select_type: SIMPLE
8
9 table: NULL
10
11 type: NULL
12
13 possible_keys: NULL
14
15 key: NULL
16
17 key_len: NULL
18
19 ref: NULL
20
21 rows: NULL
22
23 Extra: Impossible WHERE noticed after reading const tables
24
25 1 row in set (0.00 sec)
26
27 ERROR:
28
29 No query specified
30
31 mysql>
32
33 mysql>
34
35 mysql> explain select * from session where sky_id in (112414853,-1,-1) \G;
36
37 *************************** 1. row ***************************
38
39 id: 1
40
41 select_type: SIMPLE
42
43 table: session
44
45 type: range
46
47 possible_keys: PRIMARY
48
49 key: PRIMARY
50
51 key_len: 4
52
53 ref: NULL
54
55 rows: 2
56
57 Extra: Using where with pushed condition
58
59 1 row in set (0.00 sec)
60
61 ERROR:
62
63 No query specified

  居然,既然,在主键上使用了=比较的sql,执行计划不正常。

  这个问题,到现在我还没分析出来是为啥,不过,千万别告诉我,第一次处理mysql的问题就是bug,虽然我个人觉得很像是某个bug

  最后,看看我的数据库的版本吧 

1 mysql> select version();
2 +——————————-+
3 | version()                     |
4 +——————————-+
5 | 5.1.27-ndb-6.3.17-cluster-gpl |
6 +——————————-+
7 1 row in set (0.01 sec)

  嗯,还有操作系统的版本:

  Linux 2.6.18-92.el5PAE #1 SMP 2008 i686 i686 i386 GNU/Linux

  欢迎mysql高手,就这个问题给予建议。

0
相关文章