MySQL 8.2.0
Source Code Documentation
estimate_selectivity.cc File Reference
#include "sql/join_optimizer/estimate_selectivity.h"
#include <sys/types.h>
#include <algorithm>
#include <initializer_list>
#include <string>
#include "my_bitmap.h"
#include "my_table_map.h"
#include "sql/field.h"
#include "sql/handler.h"
#include "sql/histograms/histogram.h"
#include "sql/item.h"
#include "sql/item_cmpfunc.h"
#include "sql/item_func.h"
#include "sql/join_optimizer/bit_utils.h"
#include "sql/join_optimizer/print_utils.h"
#include "sql/join_optimizer/relational_expression.h"
#include "sql/key.h"
#include "sql/sql_bitmap.h"
#include "sql/sql_const.h"
#include "sql/sql_select.h"
#include "sql/table.h"
#include "template_utils.h"

Classes

struct  anonymous_namespace{estimate_selectivity.cc}::KeySelectivityResult
 Return type for EstimateSelectivityFromIndexStatistics(). More...
 

Namespaces

namespace  anonymous_namespace{estimate_selectivity.cc}
 

Typedefs

using anonymous_namespace{estimate_selectivity.cc}::EqualFieldArray = Bounds_checked_array< const Field *const >
 The set of fields that are equal in an equijoin predicate. More...
 

Functions

double anonymous_namespace{estimate_selectivity.cc}::HistogramSelectivity (const Field &field, string *trace)
 Return the selectivity of 'field' derived from a histogram, or -1.0 if there was no histogram. More...
 
double anonymous_namespace{estimate_selectivity.cc}::KeyCap (const Field &field, uint key_no, string *trace)
 Check if there is a unique index on key number 'key_no' of 'field'. More...
 
double anonymous_namespace{estimate_selectivity.cc}::FindSelectivityCap (const Field &field, string *trace)
 Check if there is a unique index on 'field'. More...
 
bool anonymous_namespace{estimate_selectivity.cc}::HasEarlierPermutedPrefix (Bounds_checked_array< const KEY > keys, uint prefix_length)
 Check if any other key in 'keys' starts with the same 'prefix_length' fields as the last key. More...
 
KeySelectivityResult anonymous_namespace{estimate_selectivity.cc}::EstimateSelectivityFromIndexStatistics (const Field &equal_field, const CompanionSet &companion_set, const TABLE &table, uint key_no, string *trace)
 
double anonymous_namespace{estimate_selectivity.cc}::EstimateEqualPredicateSelectivity (const EqualFieldArray &equal_fields, const CompanionSet &companion_set, string *trace)
 Estimate the selectivity of (equi)joining a set of fields. More...
 
double EstimateSelectivity (THD *thd, Item *condition, const CompanionSet &companion_set, string *trace)
 For the given condition, to try estimate its filtering selectivity, on a 0..1 scale (where 1.0 lets all records through). More...
 

Function Documentation

◆ EstimateSelectivity()

double EstimateSelectivity ( THD thd,
Item condition,
const CompanionSet companion_set,
string *  trace 
)

For the given condition, to try estimate its filtering selectivity, on a 0..1 scale (where 1.0 lets all records through).