I have the following request
EXPLAIN SELECT COUNT(DISTINCT ip_address) as ip_address, exec_date FROM requests GROUP BY exec_date; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE requests range NULL daily_ips 263 NULL 488213 Using index for group-by (scanning)
With daily_ips coverage daily_ips
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment requests 1 daily_ips 1 exec_date A 16 NULL NULL YES BTREE requests 1 daily_ips 2 ip_address A 483492 NULL NULL YES BTREE
Can this query be further optimized?
What exactly does Using index for group-by (scanning) mean? Does this mean that the entire GROUP BY is executed entirely from the index, and that the COUNT(DISTINCT ip_address) part COUNT(DISTINCT ip_address) is not in the expression?
user784637
source share