MySQL 8.0.40
Source Code Documentation
singleton.h File Reference

Singleton histogram. More...

#include <stddef.h>
#include <string>
#include "my_inttypes.h"
#include "mysql_time.h"
#include "sql/histograms/histogram.h"
#include "sql/histograms/value_map_type.h"
#include "sql/mem_root_allocator.h"
#include "sql/mem_root_array.h"
#include "sql/my_decimal.h"
#include "sql_string.h"

Go to the source code of this file.

Classes

struct  histograms::SingletonBucket< T >
 
class  histograms::Singleton< T >
 

Namespaces

namespace  histograms
 

Detailed Description

Singleton histogram.

This file defines the Singleton histogram. A Singleton histogram is a histogram where only a value and it's frequency is stored. It allows us to use less storage space, as well as estimating selectivity a bit more efficient.

A singleton histogram converted to a JSON object, follows the following "schema":

{ Last time the histogram was updated. As of now, this means "when the histogram was created" (incremental updates are not supported). Date/time is given in UTC. – J_DATETIME "last-updated": "2015-11-04 15:19:51.000000",

Histogram type. Always "singleton" for singleton histograms. – J_STRING "histogram-type": "singleton",

Fraction of NULL values. This is the total fraction of NULL values in the original data set. – J_DOUBLE "null-values": 0.1,

Histogram buckets. May be an empty array, if for instance the source only contains NULL values. – J_ARRAY "buckets": [ [ Value – Data type depends on the source column. 42,

Cumulative frequency – J_DOUBLE 0.001978728666831561 ] ] }