Why are almost all ROWS_EXAMINED values 0 in events_statements_* tables (performance_schema) !?
This is the main Knowledgebase category for MariaDB.
Follow any of the links below to find information on the topics you are interested in. If you would like to know more about anything that isn't documented, ask a question at the place where the answers should be and we will do our best to provide an answer for it!
Answer
Because number of examined rows is accumulated locally per JOIN object (basically — per SELECT) and at the end of the execution they're all added up, so in many cases ROWS_EXAMINED only becomes non-zero at the end of the query.
But not always. If you try SELECT with subqueries, you might see non-zero ROWS_EXAMINED when a subquery was already executed but top-level SELECT is still in progress. If you have a dependent subquery (that will be executed many times witin you top-level SELECT), you might see how ROWS_EXAMINED is gradually increases.
Perhaps you can also see non-zero ROWS_EXAMINED with UNION.