[英]Query is too slow, how can I optimize it?
我有一個包含大量數據的數據庫,但查詢優化存在問題。 如何優化此查詢
explain SELECT distinct UNIX_TIMESTAMP(timestamp)*1000 as timestamp,count(ip_src) as counter from acid_event a,saher.network n where inet_aton(n.net)!=a.ip_src group by timestamp;
+----+-------------+-------+-------+---------------+-------------+--------- +------+---------+----------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+-------+---------------+-------------+---------+------+---------+----------------------------------------------+
| 1 | SIMPLE | n | index | NULL | fsi | 27 | NULL | 2691027 | Using index; Using temporary; Using filesort |
| 1 | SIMPLE | a | index | NULL | timestamp_2 | 13 | NULL | 6770718 | Using where; Using index; Using join buffer |
+----+-------------+-------+-------+---------------+-------------+---------+------+---------+----------------------------------------------+
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.