MySQL 8.4.2
Source Code Documentation
|
Histogram base class. More...
#include <cstddef>
#include <functional>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <utility>
#include "lex_string.h"
#include "my_base.h"
#include "sql/field.h"
#include "sql/histograms/value_map_type.h"
#include "sql/mem_root_allocator.h"
#include "sql/stateless_allocator.h"
Go to the source code of this file.
Classes | |
struct | histograms::Histogram_psi_key_alloc |
class | histograms::Error_context |
Error context to validate given JSON object which represents a histogram. More... | |
class | histograms::Histogram |
Histogram base class. More... | |
struct | histograms::HistogramSetting |
A simple struct containing the settings for a histogram to be built. More... | |
Namespaces | |
namespace | dd |
The version of the current data dictionary table definitions. | |
namespace | histograms |
Typedefs | |
template<class T > | |
using | histograms::Histogram_key_allocator = Stateless_allocator< T, Histogram_psi_key_alloc > |
template<class T > | |
using | histograms::value_map_allocator = Mem_root_allocator< std::pair< const T, ha_rows > > |
template<typename T > | |
using | histograms::value_map_type = std::map< T, ha_rows, Histogram_comparator, value_map_allocator< T > > |
using | histograms::columns_set = std::set< std::string, std::less< std::string >, Histogram_key_allocator< std::string > > |
using | histograms::results_map = std::map< std::string, Message, std::less< std::string >, Histogram_key_allocator< std::pair< const std::string, Message > > > |
Functions | |
bool | histograms::empty (const Histogram &histogram) |
Return true if 'histogram' was built on an empty table. More... | |
template<class T > | |
Histogram * | histograms::build_histogram (MEM_ROOT *mem_root, const Value_map< T > &value_map, size_t num_buckets, const std::string &db_name, const std::string &tbl_name, const std::string &col_name) |
Create a histogram from a value map. More... | |
bool | histograms::update_histograms (THD *thd, Table_ref *table, Mem_root_array< HistogramSetting > *settings, results_map &results) |
Create or update histograms for a set of columns of a given table. More... | |
bool | histograms::auto_update_table_histograms (THD *thd, Table_ref *table) |
Updates existing histograms on a table that were specified with the AUTO UPDATE option. More... | |
bool | histograms::update_share_histograms (THD *thd, Table_ref *table) |
Retrieve an updated snapshot of the histograms on a table directly from the dictionary (in an inefficient manner, querying all columns) and inserts this snapshot in the Table_histograms_collection on the TABLE_SHARE. More... | |
bool | histograms::auto_update_table_histograms_from_background_thread (THD *thd, const std::string &db_name, const std::string &table_name) |
Updates existing histograms on a table that were specified with the AUTO UPDATE option. More... | |
bool | histograms::drop_all_histograms (THD *thd, Table_ref &table, const dd::Table &original_table_def, results_map &results) |
Drop histograms for all columns in a given table. More... | |
bool | histograms::drop_histograms (THD *thd, Table_ref &table, const columns_set &columns, results_map &results) |
Drop histograms for a set of columns in a given table. More... | |
bool | histograms::rename_histograms (THD *thd, const char *old_schema_name, const char *old_table_name, const char *new_schema_name, const char *new_table_name, results_map &results) |
Rename histograms for all columns in a given table. More... | |
bool | histograms::find_histogram (THD *thd, const std::string &schema_name, const std::string &table_name, const std::string &column_name, const Histogram **histogram) |
Variables | |
static const double | histograms::INVALID_NULL_VALUES_FRACTION = -1.0 |
The default (and invalid) value for "m_null_values_fraction". More... | |
Histogram base class.
This file defines the base class for all histogram types. We keep the base class itself non-templatized in order to more easily send a histogram as an argument, collect multiple histograms in a single collection etc.
A histogram is stored as a JSON object. This gives the flexibility of storing virtually an unlimited number of buckets, data values in its full length and easily expanding with new histogram types in the future. They are stored persistently in the system table mysql.column_stats.
We keep all histogram code in the namespace "histograms" in order to avoid name conflicts etc.