我有一個表message_message
3000000條記錄。innoDB緩慢計數(*)
當我做一個COUNT(*)查詢,這是非常緩慢...:
的mysql>select count(*) from message_message
;
+ ---------- +
| count(*)|
+ ---------- +
| 2819416 |
+ ---------- +
1行中組(2分鐘35.35秒)
解釋: 的MySQL>explain select count(*) from message_message
;
| id | SELECT_TYPE |表| |鍵入| possible_keys |鍵| key_len | ref | rows | Extra |
| 1 | SIMPLE | message_message | index | NULL | PRIMARY | 4 | NULL | 2939870 |使用index |
1排(0.02秒)
會發生什麼?
你需要一個確切的數字,還是將估計做? – 2012-07-16 13:50:37
Django管理員需要一個確切的分頁號碼:( – 2012-07-16 14:05:58
http://stackoverflow.com/questions/10433173/prevent-django-admin-from-running-select-count-on-the-list-form sloved! – 2012-07-17 00:37:32