MySQL 8.0.40
Source Code Documentation
path_helpers.h File Reference

Various small helpers to abstract over the fact that AccessPath can contain a number of different range scan types. More...

Go to the source code of this file.

Functions

bool is_loose_index_scan (const AccessPath *path)
 
bool is_agg_loose_index_scan (const AccessPath *path)
 
bool reverse_sort_possible (const AccessPath *path)
 Whether the range access method is capable of returning records in reverse order. More...
 
bool is_reverse_sorted_range (const AccessPath *path)
 Whether the access path is an INDEX_RANGE_SCAN that returns rows in reverse order. More...
 
bool make_reverse (uint used_key_parts, AccessPath *path)
 Ask the AccessPath to reverse itself; returns false if successful. More...
 
void set_need_sorted_output (AccessPath *path)
 
unsigned used_index (const AccessPath *path)
 If this is an index range scan, and that range scan uses a single index, returns the index used. More...
 
bool unique_key_range (const AccessPath *path)
 Return true if there is only one range and this uses the whole unique key. More...
 
void get_fields_used (const AccessPath *path, MY_BITMAP *used_fields)
 
unsigned get_used_key_parts (const AccessPath *path)
 
bool uses_index_on_fields (const AccessPath *path, const MY_BITMAP *fields)
 Return whether any index used by this range scan uses the field(s) marked in passed bitmap. More...
 
unsigned get_max_used_key_length (const AccessPath *path)
 Get the total length of first used_key_parts parts of the key, in bytes. More...
 
void add_info_string (const AccessPath *path, String *str)
 
void add_keys_and_lengths (const AccessPath *path, String *key_names, String *used_lengths)
 
void trace_basic_info (THD *thd, const AccessPath *path, const RANGE_OPT_PARAM *param, Opt_trace_object *trace_object)
 Add basic info for this range scan to the optimizer trace. More...
 
bool get_forced_by_hint (const AccessPath *path)
 
void dbug_dump (const AccessPath *path, int indent, bool verbose)
 

Detailed Description

Various small helpers to abstract over the fact that AccessPath can contain a number of different range scan types.

Function Documentation

◆ add_info_string()

void add_info_string ( const AccessPath path,
String str 
)
inline

◆ add_keys_and_lengths()

void add_keys_and_lengths ( const AccessPath path,
String key_names,
String used_lengths 
)
inline

◆ dbug_dump()

void dbug_dump ( const AccessPath path,
int  indent,
bool  verbose 
)
inline

◆ get_fields_used()

void get_fields_used ( const AccessPath path,
MY_BITMAP used_fields 
)
inline

◆ get_forced_by_hint()

bool get_forced_by_hint ( const AccessPath path)
inline

◆ get_max_used_key_length()

unsigned get_max_used_key_length ( const AccessPath path)
inline

Get the total length of first used_key_parts parts of the key, in bytes.

Only applicable for range access types that use a single index (others will assert-fail).

◆ get_used_key_parts()

unsigned get_used_key_parts ( const AccessPath path)
inline

◆ is_agg_loose_index_scan()

bool is_agg_loose_index_scan ( const AccessPath path)
inline

◆ is_loose_index_scan()

bool is_loose_index_scan ( const AccessPath path)
inline

◆ is_reverse_sorted_range()

bool is_reverse_sorted_range ( const AccessPath path)
inline

Whether the access path is an INDEX_RANGE_SCAN that returns rows in reverse order.

(Note that non-range index scans return false here.)

◆ make_reverse()

bool make_reverse ( uint  used_key_parts,
AccessPath path 
)
inline

Ask the AccessPath to reverse itself; returns false if successful.

Overridden only in INDEX_RANGE_SCAN.

◆ reverse_sort_possible()

bool reverse_sort_possible ( const AccessPath path)
inline

Whether the range access method is capable of returning records in reverse order.

◆ set_need_sorted_output()

void set_need_sorted_output ( AccessPath path)
inline

◆ trace_basic_info()

void trace_basic_info ( THD thd,
const AccessPath path,
const RANGE_OPT_PARAM param,
Opt_trace_object trace_object 
)
inline

Add basic info for this range scan to the optimizer trace.

path must be a range scan, or there will be an assert.

Parameters
thdThread handle
paramParameters for range analysis of this table
trace_objectThe optimizer trace object the info is appended to

◆ unique_key_range()

bool unique_key_range ( const AccessPath path)
inline

Return true if there is only one range and this uses the whole unique key.

◆ used_index()

unsigned used_index ( const AccessPath path)
inline

If this is an index range scan, and that range scan uses a single index, returns the index used.

Otherwise, MAX_KEY.

◆ uses_index_on_fields()

bool uses_index_on_fields ( const AccessPath path,
const MY_BITMAP fields 
)
inline

Return whether any index used by this range scan uses the field(s) marked in passed bitmap.

Assert-fails if not a range scan.