MySQL 8.3.0
Source Code Documentation
range_optimizer.h File Reference
#include <assert.h>
#include <sys/types.h>
#include <algorithm>
#include "my_base.h"
#include "my_inttypes.h"
#include "my_table_map.h"
#include "prealloced_array.h"
#include "sql/field.h"
#include "sql/handler.h"
#include "sql/item_func.h"
#include "sql/iterators/row_iterator.h"
#include "sql/key_spec.h"
#include "sql/malloc_allocator.h"
#include "sql/sql_bitmap.h"
#include "sql/sql_const.h"
#include "sql_string.h"

Go to the source code of this file.

Classes

struct  KEY_PART
 
class  QUICK_RANGE
 

Typedefs

using Quick_ranges = Mem_root_array< QUICK_RANGE * >
 
using Quick_ranges_array = Mem_root_array< Quick_ranges * >
 

Functions

bool setup_range_optimizer_param (THD *thd, MEM_ROOT *return_mem_root, MEM_ROOT *temp_mem_root, Key_map keys_to_use, TABLE *table, Query_block *query_block, RANGE_OPT_PARAM *param)
 
int test_quick_select (THD *thd, MEM_ROOT *return_mem_root, MEM_ROOT *temp_mem_root, Key_map keys_to_use, table_map prev_tables, table_map read_tables, ha_rows limit, bool force_quick_range, const enum_order interesting_order, TABLE *table, bool skip_records_in_range, Item *cond, Key_map *needed_reg, bool ignore_table_scan, Query_block *query_block, AccessPath **path)
 
void store_key_image_to_rec (Field *field, uchar *ptr, uint len)
 
void range_optimizer_init ()
 Global initialization of the null_element. Call on server start. More...
 
void range_optimizer_free ()
 Global destruction of the null_element. Call on server stop. More...
 
bool comparable_in_index (Item *cond_func, const Field *field, const Field::imagetype itype, Item_func::Functype comp_type, const Item *value)
 Test if 'value' is comparable to 'field' when setting up range access for predicate "field OP value". More...
 
void trace_quick_description (const AccessPath *path, Opt_trace_context *trace)
 

Variables

String null_string
 

Typedef Documentation

◆ Quick_ranges

◆ Quick_ranges_array

Function Documentation

◆ comparable_in_index()

bool comparable_in_index ( Item cond_func,
const Field field,
const Field::imagetype  itype,
Item_func::Functype  comp_type,
const Item value 
)

Test if 'value' is comparable to 'field' when setting up range access for predicate "field OP value".

'field' is a field in the table being optimized for while 'value' is whatever 'field' is compared to.

Parameters
cond_functhe predicate item that compares 'field' with 'value'
fieldfield in the predicate
itypeitMBR if indexed field is spatial, itRAW otherwise
comp_typecomparator for the predicate
valuewhatever 'field' is compared to
Returns
true if 'field' and 'value' are comparable, false otherwise

◆ range_optimizer_free()

void range_optimizer_free ( )

Global destruction of the null_element. Call on server stop.

◆ range_optimizer_init()

void range_optimizer_init ( )

Global initialization of the null_element. Call on server start.

◆ setup_range_optimizer_param()

bool setup_range_optimizer_param ( THD thd,
MEM_ROOT return_mem_root,
MEM_ROOT temp_mem_root,
Key_map  keys_to_use,
TABLE table,
Query_block query_block,
RANGE_OPT_PARAM param 
)

◆ store_key_image_to_rec()

void store_key_image_to_rec ( Field field,
uchar ptr,
uint  len 
)

◆ test_quick_select()

int test_quick_select ( THD thd,
MEM_ROOT return_mem_root,
MEM_ROOT temp_mem_root,
Key_map  keys_to_use,
table_map  prev_tables,
table_map  read_tables,
ha_rows  limit,
bool  force_quick_range,
const enum_order  interesting_order,
TABLE table,
bool  skip_records_in_range,
Item cond,
Key_map needed_reg,
bool  ignore_table_scan,
Query_block query_block,
AccessPath **  path 
)

◆ trace_quick_description()

void trace_quick_description ( const AccessPath path,
Opt_trace_context trace 
)

Variable Documentation

◆ null_string

String null_string
extern