Hi, Federico! On Mar 23, Federico Razzoli wrote:
Hello list
I found out that EXPLAIN SELECT aggregate_func() FROM connect_table returns a "rows" value which is much greater than the rows in the table. For example:
MariaDB [test]> SELECT COUNT(*) FROM t; +----------+ | COUNT(*) | +----------+ | 1000000 | +----------+ 1 row in set (0.49 sec)
MariaDB [test]> EXPLAIN SELECT COUNT(*) FROM t; +------+-------------+-------+------+---------------+------+---------+------+---------+-------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +------+-------------+-------+------+---------------+------+---------+------+---------+-------+ | 1 | SIMPLE | t | ALL | NULL | NULL | NULL | NULL | 7783705 | | +------+-------------+-------+------+---------------+------+---------+------+---------+-------+
So, my question is: is there any difference in the output of EXPLAIN with CONNECT? Is CONNECT really reading 7.8 millions rows in a table with only 1 million rows?
No, most probably it means that CONNECT estimates in this case are way off. Could you show a complete test case for this? Regards, Sergei