2012-10-16 18 views
13

sto cercando di ottenere un (ordine di grandezza) stima approssimativa di quanto tempo la seguente query potrebbe prendere:Come stimare il tempo di interrogazione SQL?

mysql> EXPLAIN SELECT t1.col1, t1_col4 FROM t1 LEFT JOIN t2 ON t1.col1=t2.col1 WHERE col2=0 AND col3 IS NULL; 
+----+-------------+--------------------+------+---------------+------------+---------+-----------------------------+---------+--------------------------+ 
| id | select_type | table    | type | possible_keys | key  | key_len | ref       | rows | Extra     | 
+----+-------------+--------------------+------+---------------+------------+---------+-----------------------------+---------+--------------------------+ 
| 1 | SIMPLE  | t1     | ref | foobar  | foobar  | 4  | const      | 9715129 |       | 
| 1 | SIMPLE  | t2     | ref | col1   | col1  | 4  | db2.t1.col1     | 42318 | Using where; Using index | 
+----+-------------+--------------------+------+---------------+------------+---------+-----------------------------+---------+--------------------------+ 
2 rows in set (0.00 sec) 

mysql> 
+1

Perché non solo eseguirlo e cronometrarlo? Dubito che possiamo dare una stima accurata. –

risposta

Problemi correlati