mirror of
https://github.com/MariaDB/server.git
synced 2025-10-14 11:42:11 +02:00
![]() This task loads the stats of the tables that are used in a query, from the trace into the optimizer. This feature is also controlled by optimizer_record_context, and is not enabled by default. The stats such as num_of_records present in the table, indexes if present then their names, along with the average number of records_per_key with in each index are loaded from the trace. Additionally, stats from range analysis i.e. ranges, and the corresponding number of records are also loaded from the trace. The trace context which is in JSON format is firstly set into the session variable optimizer_trace_stored_context. Later, when a user issues a query, the contents of optimizer_trace_stored_context variable is parsed and an in memory representation is build using the class Optimizer_Trace_Stored_Context_Extractor. This class is then used by the optimizer to update and save original values of the tables, indexes, and range stats in the methods "set_statistics_for_table()" of sql_statistics.cc, and "check_quick_select()" of opt_range.cc. After the query gets finished, the statistics that were updated in the optimizer are restored back to the saved original values. The entry point for parsing the json structure is in "mysql_execute_command()" of sql_parse.cc, and similarly exit point i.e. to restore the saved stats of the optimizer is at the end of the same method. |
||
---|---|---|
.. | ||
archive | ||
atomic | ||
binlog | ||
binlog_encryption | ||
client | ||
compat | ||
csv | ||
encryption | ||
engines | ||
events | ||
federated | ||
funcs_1 | ||
funcs_2 | ||
galera | ||
galera_3nodes | ||
galera_3nodes_sr | ||
galera_sr | ||
gcol | ||
handler | ||
heap | ||
innodb | ||
innodb_fts | ||
innodb_gis | ||
innodb_i_s | ||
innodb_zip | ||
jp | ||
json | ||
large_tests | ||
maria | ||
mariabackup | ||
merge | ||
mtr/t | ||
mtr2 | ||
multi_source | ||
optimizer_unfixed_bugs | ||
parts | ||
perfschema | ||
perfschema_stress | ||
period | ||
plugins | ||
roles | ||
rpl | ||
s3 | ||
sql_sequence | ||
storage_engine | ||
stress | ||
sys_vars | ||
sysschema | ||
unit | ||
vcol | ||
versioning | ||
wsrep |