Description\n-----------\n\nThis article describes how to interpret r_rows and r_filtered members in ANALYZE FORMAT=JSON when an index-based access method is used.\n\nIndex-based access method\n\nIndex-based access method may employ some or all of the following:\n\n Index Condition Pushdown\n Rowid Filtering\n attached_condition checking\n\nConsider a table access which does all three:\n\n``json\n"table": {\n    "table_name": "t1",\n    "access_type": "range",\n    "possible_keys": ...,\n    "key": "INDEX1",\n    ...\n    "rowid_filter": {\n      ...\n      "r_selectivity_pct": n.nnn,\n    },\n    ...\n    "rows": 123,\n    "r_rows": 125,\n    ...\n    "filtered": 8.476269722,\n    "r_filtered": 100,\n    "index_condition": "cond1",\n    "attached_condition": "cond2"\n  }\n`\n\nThe access is performed as follows:\n\nAccess diagram\n\n!index-read-diagram-3\n\nStatistics values in MariaDB before 11.5\n\nIn MariaDB versions before 11.5, the counters were counted as follows:\n\n!index-read-stats-old\n\nthat is,\n\n r_rows is counted after Index Condition Pushdown check and Rowid Filter check.\n r_filtered only counts selectivity of the attached_condition.\n selectivity of the Rowid Filter is in rowid_filter.r_selectivity_pct.\n\nStatistics values in MariaDB 11.5 and later versions\n\nStarting from MariaDB 11.5 (MDEV-18478), the row counters are:\n\n r_index_rows counts the number of enumerated index tuples, before any checks are made\n r_rows is the same as before - number of rows after index checks.\n\nThe selectivity counters are:\n\n r_icp_filtered is the percentage of records left after pushed index condition check.\n rowid_filter.r_selectivity_pct shows selectivity of Rowid Filter, as before.\n r_filtered is the selectivity of attached_condition check, as before.\n r_total_filtered is the combined selectivity of all checks.\n\n!index-read-stats-new\n\nANALYZE output members\n\nin ANALYZE FORMAT=JSON output these members are placed as follows:\n\n`json\n"table": {\n    "table_name": ...,\n\n    "rows": 426,\n    "r_index_rows": 349,\n    "r_rows": 34,\n`\n\nWhenever applicable, r_index_rows is shown. It is comparable with rows - both are numbers of rows to enumerate before any filtering is done.\\\nIf r_index_rows is not shown, r_rows shows the number of records enumerated.\n\nThen, filtering members:\n\n`json\n...\n    "filtered": 8.476269722,\n    "r_total_filtered": 9.742120344,\n`\n\nfiltered is comparable with r_total_filtered: both show total amount of filtering.\n\n`json\n...\n    "index_condition": "lineitem.l_quantity > 47",\n    "r_icp_filtered": 100,\n`\n\nICP and its observed filtering. The optimizer doesn't compute an estimate for this currently.\n\n`json\n...\n    "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",\n    "r_filtered": 100\n`\n\nattached_condition` and its observed filtering.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/analyze-interpreting-rows-and-filtered-members