MySQL 8.0.39
Source Code Documentation
partition_pruning.cc File Reference
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include "field_types.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_bitmap.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "sql/check_stack.h"
#include "sql/field.h"
#include "sql/handler.h"
#include "sql/item.h"
#include "sql/mem_root_array.h"
#include "sql/partition_info.h"
#include "sql/psi_memory_key.h"
#include "sql/range_optimizer/internal.h"
#include "sql/range_optimizer/range_analysis.h"
#include "sql/range_optimizer/range_optimizer.h"
#include "sql/range_optimizer/tree.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_lex.h"
#include "sql/sql_list.h"
#include "sql/sql_partition.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "sql/thr_malloc.h"

Classes

struct  PART_PRUNE_PARAM
 

Typedefs

typedef void(* mark_full_part_func) (partition_info *, uint32)
 

Functions

static bool create_partition_index_description (PART_PRUNE_PARAM *prune_par)
 
static int find_used_partitions (THD *thd, PART_PRUNE_PARAM *ppar, SEL_ROOT *key_tree)
 
static int find_used_partitions (THD *thd, PART_PRUNE_PARAM *ppar, SEL_ROOT::Type type, SEL_ARG *key_tree)
 
static int find_used_partitions_imerge (THD *thd, PART_PRUNE_PARAM *ppar, SEL_IMERGE *imerge)
 
static int find_used_partitions_imerge_list (THD *thd, PART_PRUNE_PARAM *ppar, List< SEL_IMERGE > &merges)
 
static void mark_all_partitions_as_used (partition_info *part_info)
 
static void print_partitioning_index (KEY_PART *parts, KEY_PART *parts_end)
 
static void dbug_print_segment_range (SEL_ARG *arg, KEY_PART *part)
 
static void dbug_print_singlepoint_range (SEL_ARG **start, uint num)
 
bool prune_partitions (THD *thd, TABLE *table, Query_block *query_block, Item *pprune_cond)
 Perform partition pruning for a given table and condition. More...
 
void store_key_image_to_rec (Field *field, uchar *ptr, uint len)
 
static void store_selargs_to_rec (PART_PRUNE_PARAM *ppar, SEL_ARG **start, int num)
 
static void mark_full_partition_used_no_parts (partition_info *part_info, uint32 part_id)
 
static void mark_full_partition_used_with_parts (partition_info *part_info, uint32 part_id)
 
static bool fields_ok_for_partition_index (Field **pfield)
 

Typedef Documentation

◆ mark_full_part_func

typedef void(* mark_full_part_func) (partition_info *, uint32)

Function Documentation

◆ create_partition_index_description()

static bool create_partition_index_description ( PART_PRUNE_PARAM prune_par)
static

◆ dbug_print_segment_range()

static void dbug_print_segment_range ( SEL_ARG arg,
KEY_PART part 
)
static

◆ dbug_print_singlepoint_range()

static void dbug_print_singlepoint_range ( SEL_ARG **  start,
uint  num 
)
static

◆ fields_ok_for_partition_index()

static bool fields_ok_for_partition_index ( Field **  pfield)
static

◆ find_used_partitions() [1/2]

static int find_used_partitions ( THD thd,
PART_PRUNE_PARAM ppar,
SEL_ROOT key_tree 
)
static

◆ find_used_partitions() [2/2]

static int find_used_partitions ( THD thd,
PART_PRUNE_PARAM ppar,
SEL_ROOT::Type  type,
SEL_ARG key_tree 
)
static

◆ find_used_partitions_imerge()

static int find_used_partitions_imerge ( THD thd,
PART_PRUNE_PARAM ppar,
SEL_IMERGE imerge 
)
static

◆ find_used_partitions_imerge_list()

static int find_used_partitions_imerge_list ( THD thd,
PART_PRUNE_PARAM ppar,
List< SEL_IMERGE > &  merges 
)
static

◆ mark_all_partitions_as_used()

static void mark_all_partitions_as_used ( partition_info part_info)
static

◆ mark_full_partition_used_no_parts()

static void mark_full_partition_used_no_parts ( partition_info part_info,
uint32  part_id 
)
static

◆ mark_full_partition_used_with_parts()

static void mark_full_partition_used_with_parts ( partition_info part_info,
uint32  part_id 
)
static

◆ print_partitioning_index()

static void print_partitioning_index ( KEY_PART parts,
KEY_PART parts_end 
)
static

◆ prune_partitions()

bool prune_partitions ( THD thd,
TABLE table,
Query_block query_block,
Item pprune_cond 
)

Perform partition pruning for a given table and condition.

Parameters
thdThread handle
tableTable to perform partition pruning for
query_blockQuery block the table is part of
pprune_condCondition to use for partition pruning
Note
This function assumes that lock_partitions are setup when it is invoked. The function analyzes the condition, finds partitions that need to be used to retrieve the records that match the condition, and marks them as used by setting appropriate bit in part_info->read_partitions In the worst case all partitions are marked as used. If the table is not yet locked, it will also unset bits in part_info->lock_partitions that is not set in read_partitions.

This function returns promptly if called for non-partitioned table.

Returns
Operation status
Return values
trueFailure
falseSuccess

◆ store_key_image_to_rec()

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

◆ store_selargs_to_rec()

static void store_selargs_to_rec ( PART_PRUNE_PARAM ppar,
SEL_ARG **  start,
int  num 
)
static