2010-09-03 51 views
7

是否有解釋這些狀態的地方?mysql profiler「發送數據」

http://dev.mysql.com/tech-resources/articles/using-new-query-profiler.html

我的具體問題是關於這個查詢:

select count(*) 
from 135_5m.record_updates u, 135_5m.records r 
where r.record_id = u.record_id and 
    (u.date_updated > null or null is null) and 
    u.date_updated <= '2011-01-03'; 

它返回一個數字 - 4053904.那麼,爲什麼大多數的時間花費在「發送數據」?它只是名字不好嗎?當然,「發送數據」不僅僅是發送數據?

+--------------------------------+-----------+-------+ 
| Status       | Duration | Swaps | 
+--------------------------------+-----------+-------+ 
| starting      | 0.000224 |  0 | 
| checking query cache for query | 0.000188 |  0 | 
| checking permissions   | 0.000012 |  0 | 
| checking permissions   | 0.000017 |  0 | 
| Opening tables     | 0.000036 |  0 | 
| System lock     | 0.000015 |  0 | 
| Table lock      | 0.000067 |  0 | 
| init       | 0.000105 |  0 | 
| optimizing      | 0.000052 |  0 | 
| statistics      | 0.000254 |  0 | 
| preparing      | 0.000061 |  0 | 
| executing      | 0.000017 |  0 | 
| Sending data     | 32.079549 |  0 | 
| end       | 0.000036 |  0 | 
| query end      | 0.000012 |  0 | 
| freeing items     | 0.000089 |  0 | 
| storing result in query cache | 0.000022 |  0 | 
| logging slow query    | 0.000008 |  0 | 
| logging slow query    | 0.000008 |  0 | 
| cleaning up     | 0.000011 |  0 | 
+--------------------------------+-----------+-------+ 
+0

題外話,但什麼是該位的目的的majrity時間'u.date_updated>空或null爲null'?肯定它總是真的? – 2010-09-07 13:00:17

+1

該查詢最初是java代碼中的預備狀態。我取代了?在我的代碼中使用實際值來測試性能。 – andersonbd1 2010-09-07 14:33:21

回答

0

將數據發送到客戶端之前,MySQL的需要讀取數據時,讀取數據的階段可能採取「發送數據」