MySQL 8.0.29
Source Code Documentation
histogram.h
Go to the documentation of this file.
1#ifndef HISTOGRAMS_HISTOGRAM_INCLUDED
2#define HISTOGRAMS_HISTOGRAM_INCLUDED
3
4/* Copyright (c) 2016, 2021, Oracle and/or its affiliates.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License, version 2.0,
8 as published by the Free Software Foundation.
9
10 This program is also distributed with certain software (including
11 but not limited to OpenSSL) that is licensed under separate terms,
12 as designated in a particular file or component or in included license
13 documentation. The authors of MySQL hereby grant you an additional
14 permission to link the program and your derivative works with the
15 separately licensed software that they have included with MySQL.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License, version 2.0, for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
25
26/**
27 @file sql/histograms/histogram.h
28 Histogram base class.
29
30 This file defines the base class for all histogram types. We keep the base
31 class itself non-templatized in order to more easily send a histogram as an
32 argument, collect multiple histograms in a single collection etc.
33
34 A histogram is stored as a JSON object. This gives the flexibility of storing
35 virtually an unlimited number of buckets, data values in its full length and
36 easily expanding with new histogram types in the future. They are stored
37 persistently in the system table mysql.column_stats.
38
39 We keep all histogram code in the namespace "histograms" in order to avoid
40 name conflicts etc.
41*/
42
43#include <cstddef> // size_t
44#include <functional>
45#include <map> // std::map
46#include <set> // std::set
47#include <string> // std::string
48#include <utility> // std::pair
49
50#include "lex_string.h" // LEX_CSTRING
51#include "my_base.h" // ha_rows
53#include "sql/mem_root_allocator.h" // Mem_root_allocator
54#include "sql/stateless_allocator.h" // Stateless_allocator
55
56class Item;
57class Json_dom;
58class Json_object;
59class THD;
60struct TYPELIB;
61
62namespace dd {
63class Table;
64} // namespace dd
65namespace histograms {
66struct Histogram_comparator;
67template <class T>
68class Value_map;
69} // namespace histograms
70struct CHARSET_INFO;
71struct MEM_ROOT;
72struct TABLE_LIST;
73
74namespace histograms {
75
76/// The default (and invalid) value for "m_null_values_fraction".
77static const double INVALID_NULL_VALUES_FRACTION = -1.0;
78
79enum class Message {
84 VIEW,
91};
92
94 void *operator()(size_t s) const;
95};
96
97template <class T>
99
100template <class T>
102
103template <typename T>
105 std::map<T, ha_rows, Histogram_comparator, value_map_allocator<T>>;
106
107using columns_set = std::set<std::string, std::less<std::string>,
109
111 std::map<std::string, Message, std::less<std::string>,
113
114/**
115 The different operators we can ask histogram statistics for selectivity
116 estimations.
117*/
118enum class enum_operator {
119 EQUALS_TO,
121 LESS_THAN,
122 IS_NULL,
127 BETWEEN,
129 IN_LIST,
131};
132
133/**
134 Histogram base class.
135
136 This is an abstract class containing the interface and shared code for
137 concrete histogram subclasses.
138
139 Histogram subclasses (Singleton, Equi_height) are constructed through factory
140 methods in order to catch memory allocation errors during construction.
141
142 The histogram subclasses have no public copy or move constructors. In order to
143 copy a histogram onto a given MEM_ROOT, use the public clone method. The clone
144 method ensures that members of the histogram, such String type buckets,
145 are also allocated on the given MEM_ROOT. Modifications to these methods need
146 to be careful that histogram buckets are cloned/copied correctly.
147*/
149 public:
150 /// All supported histogram types in MySQL.
152
153 /// String representation of the JSON field "histogram-type".
154 static constexpr const char *histogram_type_str() { return "histogram-type"; }
155
156 /// String representation of the JSON field "data-type".
157 static constexpr const char *data_type_str() { return "data-type"; }
158
159 /// String representation of the JSON field "collation-id".
160 static constexpr const char *collation_id_str() { return "collation-id"; }
161
162 /// String representation of the histogram type SINGLETON.
163 static constexpr const char *singleton_str() { return "singleton"; }
164
165 /// String representation of the histogram type EQUI-HEIGHT.
166 static constexpr const char *equi_height_str() { return "equi-height"; }
167
168 protected:
170
171 /// The fraction of NULL values in the histogram (between 0.0 and 1.0).
173
174 /// The character set for the data stored
176
177 /// The number of buckets originally specified
179
180 /// String representation of the JSON field "buckets".
181 static constexpr const char *buckets_str() { return "buckets"; }
182
183 /// String representation of the JSON field "last-updated".
184 static constexpr const char *last_updated_str() { return "last-updated"; }
185
186 /// String representation of the JSON field "null-values".
187 static constexpr const char *null_values_str() { return "null-values"; }
188
189 static constexpr const char *sampling_rate_str() { return "sampling-rate"; }
190
191 /// String representation of the JSON field "number-of-buckets-specified".
192 static constexpr const char *numer_of_buckets_specified_str() {
193 return "number-of-buckets-specified";
194 }
195
196 /**
197 Constructor.
198
199 @param mem_root the mem_root where the histogram contents will be allocated
200 @param db_name name of the database this histogram represents
201 @param tbl_name name of the table this histogram represents
202 @param col_name name of the column this histogram represents
203 @param type the histogram type (equi-height, singleton)
204 @param data_type the type of data that this histogram contains
205 @param[out] error is set to true if an error occurs
206 */
207 Histogram(MEM_ROOT *mem_root, const std::string &db_name,
208 const std::string &tbl_name, const std::string &col_name,
209 enum_histogram_type type, Value_map_type data_type, bool *error);
210
211 /**
212 Copy constructor
213
214 This will make a copy of the provided histogram onto the provided MEM_ROOT.
215
216 @param mem_root the mem_root where the histogram contents will be allocated
217 @param other the histogram to copy
218 @param[out] error is set to true if an error occurs
219 */
220 Histogram(MEM_ROOT *mem_root, const Histogram &other, bool *error);
221
222 /**
223 Write the data type of this histogram into a JSON object.
224
225 @param json_object the JSON object where we will write the histogram
226 data type
227
228 @return true on error, false otherwise
229 */
230 bool histogram_data_type_to_json(Json_object *json_object) const;
231
232 /**
233 Return the value that is contained in the JSON DOM object.
234
235 For most types, this function simply returns the contained value. For String
236 values, the value is allocated on this histograms MEM_ROOT before it is
237 returned. This allows the String value to survive the entire lifetime of the
238 histogram object.
239
240 @param json_dom the JSON DOM object to extract the value from
241 @param out the value from the JSON DOM object
242
243 @return true on error, false otherwise
244 */
245 template <class T>
246 bool extract_json_dom_value(const Json_dom *json_dom, T *out);
247
248 /**
249 Populate the histogram with data from the provided JSON object. The base
250 class also provides an implementation that subclasses must call in order
251 to populate fields that are shared among all histogram types (character set,
252 null values fraction).
253
254 @param json_object the JSON object to read the histogram data from
255
256 @return true on error, false otherwise
257 */
258 virtual bool json_to_histogram(const Json_object &json_object) = 0;
259
260 private:
261 /// The MEM_ROOT where the histogram contents will be allocated.
263
264 /// The type of this histogram.
266
267 /// The type of the data this histogram contains.
269
270 /// Name of the database this histogram represents.
272
273 /// Name of the table this histogram represents.
275
276 /// Name of the column this histogram represents.
278
279 /**
280 An internal function for getting the selecitvity estimation.
281
282 This function will read/evaluate the value from the given Item, and pass
283 this value on to the correct selectivity estimation function based on the
284 data type of the histogram. For instance, if the data type of the histogram
285 is INT, we will call "val_int" on the Item to evaulate the value as an
286 integer and pass this value on to the next function.
287
288 @param item The Item to read/evaluate the value from.
289 @param op The operator we are estimating the selectivity for.
290 @param typelib In the case of ENUM or SET data type, this parameter holds
291 the type information. This is needed in order to map a
292 string representation of an ENUM/SET value into its correct
293 integer representation (ENUM/SET values are stored as
294 integer values in the histogram).
295 @param[out] selectivity The estimated selectivity, between 0.0 and 1.0
296 inclusive.
297
298 @return true on error (i.e the provided item was NULL), false on success.
299 */
300 bool get_selectivity_dispatcher(Item *item, const enum_operator op,
301 const TYPELIB *typelib,
302 double *selectivity) const;
303
304 /**
305 An internal function for getting the selecitvity estimation.
306
307 This function will cast the histogram to the correct class (using down_cast)
308 and pass the given value on to the correct selectivity estimation function
309 for that class.
310
311 @param value The value to estimate the selectivity for.
312
313 @return The estimated selectivity, between 0.0 and 1.0 inclusive.
314 */
315 template <class T>
316 double get_less_than_selectivity_dispatcher(const T &value) const;
317
318 /// @see get_less_than_selectivity_dispatcher
319 template <class T>
320 double get_greater_than_selectivity_dispatcher(const T &value) const;
321
322 /// @see get_less_than_selectivity_dispatcher
323 template <class T>
324 double get_equal_to_selectivity_dispatcher(const T &value) const;
325
326 /**
327 An internal function for applying the correct function for the given
328 operator.
329
330 @param op The operator to apply
331 @param value The value to find the selectivity for.
332
333 @return The estimated selectivity, between 0.0 and 1.0 inclusive.
334 */
335 template <class T>
336 double apply_operator(const enum_operator op, const T &value) const;
337
338 public:
339 Histogram() = delete;
340 Histogram(const Histogram &other) = delete;
341
342 /// Destructor.
343 virtual ~Histogram() = default;
344
345 /// @return the MEM_ROOT that this histogram uses for allocations
346 MEM_ROOT *get_mem_root() const { return m_mem_root; }
347
348 /**
349 @return name of the database this histogram represents
350 */
352
353 /**
354 @return name of the table this histogram represents
355 */
356 const LEX_CSTRING get_table_name() const { return m_table_name; }
357
358 /**
359 @return name of the column this histogram represents
360 */
361 const LEX_CSTRING get_column_name() const { return m_column_name; }
362
363 /**
364 @return type of this histogram
365 */
367
368 /**
369 @return the fraction of NULL values, in the range [0.0, 1.0]
370 */
371 double get_null_values_fraction() const;
372
373 /// @return the character set for the data this histogram contains
374 const CHARSET_INFO *get_character_set() const { return m_charset; }
375
376 /// @return the sampling rate used to generate this histogram
377 double get_sampling_rate() const { return m_sampling_rate; }
378
379 /**
380 Returns the histogram type as a readable string.
381
382 @return a readable string representation of the histogram type
383 */
384 virtual std::string histogram_type_to_str() const = 0;
385
386 /**
387 @return number of buckets in this histogram
388 */
389 virtual size_t get_num_buckets() const = 0;
390
391 /**
392 Get the estimated number of distinct non-NULL values.
393 @return number of distinct non-NULL values
394 */
395 virtual size_t get_num_distinct_values() const = 0;
396
397 /**
398 @return the data type that this histogram contains
399 */
401
402 /**
403 @return number of buckets originally specified by the user. This may be
404 higher than the actual number of buckets in the histogram.
405 */
407
408 /**
409 Converts the histogram to a JSON object.
410
411 @param[in,out] json_object output where the histogram is to be stored. The
412 caller is responsible for allocating/deallocating the JSON
413 object
414
415 @return true on error, false otherwise
416 */
417 virtual bool histogram_to_json(Json_object *json_object) const = 0;
418
419 /**
420 Converts JSON object to a histogram.
421
422 @param mem_root MEM_ROOT where the histogram will be allocated
423 @param schema_name the schema name
424 @param table_name the table name
425 @param column_name the column name
426 @param json_object output where the histogram is stored
427
428 @return nullptr on error. Otherwise a histogram allocated on the provided
429 MEM_ROOT.
430 */
432 const std::string &schema_name,
433 const std::string &table_name,
434 const std::string &column_name,
435 const Json_object &json_object);
436
437 /**
438 Make a clone of the current histogram
439
440 @param mem_root the MEM_ROOT on which the new histogram will be allocated.
441
442 @return a histogram allocated on the provided MEM_ROOT. Returns nullptr
443 on error.
444 */
445 virtual Histogram *clone(MEM_ROOT *mem_root) const = 0;
446
447 /**
448 Store this histogram to persistent storage (data dictionary).
449
450 @param thd Thread handler.
451
452 @return false on success, true on error.
453 */
454 bool store_histogram(THD *thd) const;
455
456 /**
457 Get selectivity estimation.
458
459 This function will try and get the selectivity estimation for a predicate
460 on the form "COLUMN OPERATOR CONSTANT", for instance "SELECT * FROM t1
461 WHERE col1 > 23;".
462
463 This function will take care of several of things, for instance checking
464 that the value we are estimating the selectivity for is a constant value.
465
466 The order of the Items provided does not matter. For instance, of the
467 operator argument given is "EQUALS_TO", it does not matter if the constant
468 value is provided as the first or the second argument; this function will
469 take care of this.
470
471 @param items an array of items that contains both the field we
472 are estimating the selectivity for, as well as the
473 user-provided constant values.
474 @param item_count the number of Items in the Item array.
475 @param op the predicate operator
476 @param[out] selectivity the calculated selectivity if a usable histogram was
477 found
478
479 @retval true if an error occurred (the Item provided was not a constant
480 value or similar).
481 @return false if success
482 */
483 bool get_selectivity(Item **items, size_t item_count, enum_operator op,
484 double *selectivity) const;
485
486 /**
487 @return the fraction of non-null values in the histogram.
488 */
490 return 1.0 - get_null_values_fraction();
491 }
492};
493
494/**
495 Create a histogram from a value map.
496
497 This function will build a histogram from a value map. The histogram type
498 depends on both the size of the input data, as well as the number of buckets
499 specified. If the number of distinct values is less than or equal to the
500 number of buckets, a Singleton histogram will be created. Otherwise, an
501 equi-height histogram will be created.
502
503 The histogram will be allocated on the supplied mem_root, and it is the
504 callers responsibility to properly clean up when the histogram isn't needed
505 anymore.
506
507 @param mem_root the MEM_ROOT where the histogram contents will be
508 allocated
509 @param value_map a value map containing [value, frequency]
510 @param num_buckets the maximum number of buckets to create
511 @param db_name name of the database this histogram represents
512 @param tbl_name name of the table this histogram represents
513 @param col_name name of the column this histogram represents
514
515 @return a histogram, using at most "num_buckets" buckets. The histogram
516 type depends on the size of the input data, and the number of
517 buckets
518*/
519template <class T>
520Histogram *build_histogram(MEM_ROOT *mem_root, const Value_map<T> &value_map,
521 size_t num_buckets, const std::string &db_name,
522 const std::string &tbl_name,
523 const std::string &col_name);
524
525/**
526 Create or update histograms for a set of columns of a given table.
527
528 This function will try to create histogram statistics for all the columns
529 specified. If one of the columns fail, it will continue to the next one and
530 try.
531
532 @param thd Thread handler.
533 @param table The table where we should look for the columns/data.
534 @param columns Columns specified by the user.
535 @param num_buckets The maximum number of buckets to create in each
536 histogram.
537 @param results A map where the result of each operation is stored.
538
539 @return false on success, true on error.
540*/
541bool update_histogram(THD *thd, TABLE_LIST *table, const columns_set &columns,
542 int num_buckets, results_map &results);
543
544/**
545 Drop histograms for all columns in a given table.
546
547 @param thd Thread handler.
548 @param table The table where we should look for the columns.
549 @param original_table_def Original table definition.
550 @param results A map where the result of each operation is stored.
551
552 @note Assumes that caller owns exclusive metadata lock on the table,
553 so there is no need to lock individual statistics.
554
555 @return false on success, true on error.
556*/
557bool drop_all_histograms(THD *thd, TABLE_LIST &table,
558 const dd::Table &original_table_def,
559 results_map &results);
560
561/**
562 Drop histograms for a set of columns in a given table.
563
564 This function will try to drop the histogram statistics for all specified
565 columns. If one of the columns fail, it will continue to the next one and try.
566
567 @param thd Thread handler.
568 @param table The table where we should look for the columns.
569 @param columns Columns specified by the user.
570 @param needs_lock Whether we need to acquire metadata locks on
571 the table and column statistics to be dropped.
572 @param results A map where the result of each operation is stored.
573
574 @note In case when needs_lock parameter is false assumes that caller
575 owns exclusive metadata lock on the table, so there is no need
576 to lock individual statistics.
577
578 @return false on success, true on error.
579*/
580bool drop_histograms(THD *thd, TABLE_LIST &table, const columns_set &columns,
581 bool needs_lock, results_map &results);
582
583/**
584 Rename histograms for all columns in a given table.
585
586 @param thd Thread handler.
587 @param old_schema_name The old schema name
588 @param old_table_name The old table name
589 @param new_schema_name The new schema name
590 @param new_table_name The new table name
591 @param results A map where the result of each operation is stored.
592
593 @return false on success, true on error.
594*/
595bool rename_histograms(THD *thd, const char *old_schema_name,
596 const char *old_table_name, const char *new_schema_name,
597 const char *new_table_name, results_map &results);
598
599bool find_histogram(THD *thd, const std::string &schema_name,
600 const std::string &table_name,
601 const std::string &column_name,
602 const Histogram **histogram);
603} // namespace histograms
604
605#endif
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:802
JSON DOM abstract base class.
Definition: json_dom.h:171
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:369
Mem_root_allocator is a C++ STL memory allocator based on MEM_ROOT.
Definition: mem_root_allocator.h:67
Stateless_allocator is a C++ STL memory allocator skeleton based on Malloc_allocator,...
Definition: stateless_allocator.h:91
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:945
Definition: table.h:46
Histogram base class.
Definition: histogram.h:148
virtual std::string histogram_type_to_str() const =0
Returns the histogram type as a readable string.
size_t m_num_buckets_specified
The number of buckets originally specified.
Definition: histogram.h:178
Value_map_type get_data_type() const
Definition: histogram.h:400
double get_equal_to_selectivity_dispatcher(const T &value) const
Definition: histogram.cc:1387
virtual size_t get_num_buckets() const =0
MEM_ROOT * m_mem_root
The MEM_ROOT where the histogram contents will be allocated.
Definition: histogram.h:262
static constexpr const char * data_type_str()
String representation of the JSON field "data-type".
Definition: histogram.h:157
double m_sampling_rate
Definition: histogram.h:169
static constexpr const char * collation_id_str()
String representation of the JSON field "collation-id".
Definition: histogram.h:160
double get_less_than_selectivity_dispatcher(const T &value) const
An internal function for getting the selecitvity estimation.
Definition: histogram.cc:1348
static constexpr const char * buckets_str()
String representation of the JSON field "buckets".
Definition: histogram.h:181
static constexpr const char * numer_of_buckets_specified_str()
String representation of the JSON field "number-of-buckets-specified".
Definition: histogram.h:192
virtual ~Histogram()=default
Destructor.
virtual size_t get_num_distinct_values() const =0
Get the estimated number of distinct non-NULL values.
double get_sampling_rate() const
Definition: histogram.h:377
const enum_histogram_type m_hist_type
The type of this histogram.
Definition: histogram.h:265
virtual bool histogram_to_json(Json_object *json_object) const =0
Converts the histogram to a JSON object.
Definition: histogram.cc:255
double get_non_null_values_frequency() const
Definition: histogram.h:489
const CHARSET_INFO * m_charset
The character set for the data stored.
Definition: histogram.h:175
static constexpr const char * last_updated_str()
String representation of the JSON field "last-updated".
Definition: histogram.h:184
LEX_CSTRING m_table_name
Name of the table this histogram represents.
Definition: histogram.h:274
Histogram(const Histogram &other)=delete
size_t get_num_buckets_specified() const
Definition: histogram.h:406
static constexpr const char * equi_height_str()
String representation of the histogram type EQUI-HEIGHT.
Definition: histogram.h:166
virtual Histogram * clone(MEM_ROOT *mem_root) const =0
Make a clone of the current histogram.
bool get_selectivity(Item **items, size_t item_count, enum_operator op, double *selectivity) const
Get selectivity estimation.
Definition: histogram.cc:1575
double m_null_values_fraction
The fraction of NULL values in the histogram (between 0.0 and 1.0).
Definition: histogram.h:172
const Value_map_type m_data_type
The type of the data this histogram contains.
Definition: histogram.h:268
const LEX_CSTRING get_database_name() const
Definition: histogram.h:351
LEX_CSTRING m_column_name
Name of the column this histogram represents.
Definition: histogram.h:277
bool get_selectivity_dispatcher(Item *item, const enum_operator op, const TYPELIB *typelib, double *selectivity) const
An internal function for getting the selecitvity estimation.
Definition: histogram.cc:1450
double apply_operator(const enum_operator op, const T &value) const
An internal function for applying the correct function for the given operator.
Definition: histogram.cc:1434
const CHARSET_INFO * get_character_set() const
Definition: histogram.h:374
const LEX_CSTRING get_table_name() const
Definition: histogram.h:356
double get_null_values_fraction() const
Definition: histogram.cc:300
MEM_ROOT * get_mem_root() const
Definition: histogram.h:346
enum_histogram_type get_histogram_type() const
Definition: histogram.h:366
LEX_CSTRING m_database_name
Name of the database this histogram represents.
Definition: histogram.h:271
bool store_histogram(THD *thd) const
Store this histogram to persistent storage (data dictionary).
Definition: histogram.cc:1155
static constexpr const char * histogram_type_str()
String representation of the JSON field "histogram-type".
Definition: histogram.h:154
bool histogram_data_type_to_json(Json_object *json_object) const
Write the data type of this histogram into a JSON object.
Definition: histogram.cc:532
static constexpr const char * singleton_str()
String representation of the histogram type SINGLETON.
Definition: histogram.h:163
bool extract_json_dom_value(const Json_dom *json_dom, T *out)
Return the value that is contained in the JSON DOM object.
static constexpr const char * sampling_rate_str()
Definition: histogram.h:189
virtual bool json_to_histogram(const Json_object &json_object)=0
Populate the histogram with data from the provided JSON object.
Definition: histogram.cc:479
double get_greater_than_selectivity_dispatcher(const T &value) const
Definition: histogram.cc:1367
const LEX_CSTRING get_column_name() const
Definition: histogram.h:361
enum_histogram_type
All supported histogram types in MySQL.
Definition: histogram.h:151
static constexpr const char * null_values_str()
String representation of the JSON field "null-values".
Definition: histogram.h:187
static MEM_ROOT mem_root
Definition: client_plugin.cc:109
This file includes constants used by all storage engines.
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:42
Definition: column_statistics.h:33
std::set< std::string, std::less< std::string >, Histogram_key_allocator< std::string > > columns_set
Definition: histogram.h:108
bool drop_histograms(THD *thd, TABLE_LIST &table, const columns_set &columns, bool needs_lock, results_map &results)
Drop histograms for a set of columns in a given table.
Definition: histogram.cc:1071
std::map< std::string, Message, std::less< std::string >, Histogram_key_allocator< std::pair< const std::string, Message > > > results_map
Definition: histogram.h:112
Message
Definition: histogram.h:79
enum_operator
The different operators we can ask histogram statistics for selectivity estimations.
Definition: histogram.h:118
bool 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.
Definition: histogram.cc:1286
Histogram * 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.
Definition: histogram.cc:310
bool find_histogram(THD *thd, const std::string &schema_name, const std::string &table_name, const std::string &column_name, const Histogram **histogram)
Definition: histogram.cc:1325
bool drop_all_histograms(THD *thd, TABLE_LIST &table, const dd::Table &table_definition, results_map &results)
Drop histograms for all columns in a given table.
Definition: histogram.cc:1061
static const double INVALID_NULL_VALUES_FRACTION
The default (and invalid) value for "m_null_values_fraction".
Definition: histogram.h:77
std::map< T, ha_rows, Histogram_comparator, value_map_allocator< T > > value_map_type
Definition: histogram.h:105
bool update_histogram(THD *thd, TABLE_LIST *table, const columns_set &columns, int num_buckets, results_map &results)
Create or update histograms for a set of columns of a given table.
Definition: histogram.cc:874
Value_map_type
Datatypes that a Value_map and histogram can hold (including the invalid type).
Definition: value_map_type.h:32
const char * table_name
Definition: rules_table_service.cc:55
const char * db_name
Definition: rules_table_service.cc:54
required string type
Definition: replication_group_member_actions.proto:33
Definition: m_ctype.h:354
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82
Definition: mysql_lex_string.h:39
Definition: table.h:2684
Definition: typelib.h:34
Definition: histogram.h:93
void * operator()(size_t s) const
Definition: histogram.cc:99