EXPLAIN ANALYZE
You are viewing an old version of this article. View
the current version here.
This page contains preliminary documentation for the EXPLAIN ANALYZE
feature.
This page describes a feature that's under development. The feature has not been released (even in beta), its interface and function may change, etc.
What it is
EXPLAIN ANALYZE SELECT
works like in PostreSQL and other databases. It runs the SELECT, and then prints EXPLAIN
output, where #record estimates are accompanied by the actual numbers encountered during the execution.
MariaDB [test]> explain analyze select * from tbl where key1 between 5000 and 5050 and col1='val-1'\G *************************** 1. row *************************** id: 1 select_type: SIMPLE table: tbl type: range possible_keys: key1 key: key1 key_len: 5 ref: NULL loops: 1 rows: 51 r_rows: 51 filtered: 100.00 r_filtered: 33.33 Extra: Using index condition; Using where 1 row in set (0.00 sec)
Note the additional columns:
- loops - Tells how many times table access was invoked. For non-join queries, this is always 1.
- r_rows - The "real" counterpart of
rows
column. It shows how many records were returned by the access method (in the above example, by the range access). - r_filtered - The "real" counterpart of
filtered
column. It shows the fraction of records that was left after"Using where"
condition was applied. (In the above example, the optimizer did not have any estimate for it, and pessimistically assumed that no records will be filtered out (filtered=100) while in actual execution 66% of the records were filtered, leaving 33%)
Where to get it
EXPLAIN ANALYZE
code is based on the code for SHOW EXPLAIN feature.- Currently, it is pushed to a separate tree at [[lp:~maria-captains/maria/5.5-explain-analyze|https://code.launchpad.net/~maria-captains/maria/5.5-explain-analyze]]
- Jira task for EXPLAIN ANALYZE: https://mariadb.atlassian.net/browse/MDEV-406
Comments
Comments loading...
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.