MySQL 9.0.0
Source Code Documentation
Sel_arg_range_sequence Class Reference

Public Member Functions

 Sel_arg_range_sequence (RANGE_OPT_PARAM *param_arg, bool *is_ror_scan_arg, uchar *min_key_arg, uchar *max_key_arg, bool skip_records_in_range_arg)
 
void reset ()
 
bool stack_empty () const
 
void stack_push_range (SEL_ARG *key_tree)
 
void stack_pop_range ()
 
int stack_size () const
 
RANGE_SEQ_ENTRYstack_top ()
 

Public Attributes

uint keyno
 
uint real_keyno
 
RANGE_OPT_PARAM *const param
 
bool * is_ror_scan
 
ucharmin_key
 
ucharmax_key
 
const bool skip_records_in_range
 
SEL_ARGstart
 
uint range_count = 0
 
uint max_key_part
 

Private Attributes

RANGE_SEQ_ENTRY stack [MAX_REF_PARTS]
 Stack of ranges for the curr_kp first keyparts. More...
 
int curr_kp
 

Constructor & Destructor Documentation

◆ Sel_arg_range_sequence()

Sel_arg_range_sequence::Sel_arg_range_sequence ( RANGE_OPT_PARAM param_arg,
bool *  is_ror_scan_arg,
uchar min_key_arg,
uchar max_key_arg,
bool  skip_records_in_range_arg 
)
inline

Member Function Documentation

◆ reset()

void Sel_arg_range_sequence::reset ( void  )
inline

◆ stack_empty()

bool Sel_arg_range_sequence::stack_empty ( ) const
inline

◆ stack_pop_range()

void Sel_arg_range_sequence::stack_pop_range ( )
inline

◆ stack_push_range()

void Sel_arg_range_sequence::stack_push_range ( SEL_ARG key_tree)

◆ stack_size()

int Sel_arg_range_sequence::stack_size ( ) const
inline

◆ stack_top()

RANGE_SEQ_ENTRY * Sel_arg_range_sequence::stack_top ( )
inline

Member Data Documentation

◆ curr_kp

int Sel_arg_range_sequence::curr_kp
private

◆ is_ror_scan

bool* Sel_arg_range_sequence::is_ror_scan

◆ keyno

uint Sel_arg_range_sequence::keyno

◆ max_key

uchar * Sel_arg_range_sequence::max_key

◆ max_key_part

uint Sel_arg_range_sequence::max_key_part

◆ min_key

uchar* Sel_arg_range_sequence::min_key

◆ param

RANGE_OPT_PARAM* const Sel_arg_range_sequence::param

◆ range_count

uint Sel_arg_range_sequence::range_count = 0

◆ real_keyno

uint Sel_arg_range_sequence::real_keyno

◆ skip_records_in_range

const bool Sel_arg_range_sequence::skip_records_in_range

◆ stack

RANGE_SEQ_ENTRY Sel_arg_range_sequence::stack[MAX_REF_PARTS]
private

Stack of ranges for the curr_kp first keyparts.

Used by sel_arg_range_seq_next() so that if the next range is equal to the previous one for the first x keyparts, stack[x-1] can be accumulated with the new range in keyparts > x to quickly form the next range to return.

Notation used below: "x:y" means a range where "column_in_keypart_0=x" and "column_in_keypart_1=y". For simplicity, only equality (no BETWEEN, < etc) is considered in the example but the same principle applies to other range predicate operators too.

Consider a query with these range predicates: (kp0=1 and kp1=2 and kp2=3) or (kp0=1 and kp1=2 and kp2=4) or (kp0=1 and kp1=3 and kp2=5) or (kp0=1 and kp1=3 and kp2=6)

1) sel_arg_range_seq_next() is called the first time

  • traverse the R-B tree (see SEL_ARG) to find the first range
  • returns range "1:2:3"
  • values in stack after this: stack[1, 1:2, 1:2:3] 2) sel_arg_range_seq_next() is called second time
  • keypart 2 has another range, so the next range in keypart 2 is appended to stack[1] and saved in stack[2]
  • returns range "1:2:4"
  • values in stack after this: stack[1, 1:2, 1:2:4] 3) sel_arg_range_seq_next() is called the third time
  • no more ranges in keypart 2, but keypart 1 has another range, so the next range in keypart 1 is appended to stack[0] and saved in stack[1]. The first range in keypart 2 is then appended to stack[1] and saved in stack[2]
  • returns range "1:3:5"
  • values in stack after this: stack[1, 1:3, 1:3:5] 4) sel_arg_range_seq_next() is called the fourth time
  • keypart 2 has another range, see 2)
  • returns range "1:3:6"
  • values in stack after this: stack[1, 1:3, 1:3:6]

◆ start

SEL_ARG* Sel_arg_range_sequence::start

The documentation for this class was generated from the following file: