I doubt that EXPLAIN will ever make any sense/would work reliably with CONNECT tables at al (though it may depend on the type of data source)l. Consequently I think that it would be better to return a(n generic) error message like "EXPLAIN is not available for the actual storage engine" (or a warning at least like "EXPLAIN may return misleading information with storage engines mapping external data sources due to non-availability of internals of the data source").  

(I use the term *generic* because it may apply to other storage engines as well (I am having Cassandra and Federated/Federated_x engines in my thoughts too).)

-- Peter


On Wed, Mar 26, 2014 at 8:44 PM, Sergei Golubchik <serg@mariadb.org> wrote:
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


_______________________________________________
Mailing list: https://launchpad.net/~maria-discuss
Post to     : maria-discuss@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-discuss
More help   : https://help.launchpad.net/ListHelp