MySQL 8.1.0
Source Code Documentation
partition_pruning.h File Reference

Go to the source code of this file.

Functions

bool prune_partitions (THD *thd, TABLE *table, Query_block *query_block, Item *pprune_cond)
 Perform partition pruning for a given table and condition. More...
 

Function Documentation

◆ 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