MySQL 8.0.39
Source Code Documentation
|
Data structure for an index. More...
#include <dict0mem.h>
Public Member Functions | |
UT_LIST_NODE_T (dict_index_t) indexes | |
list of indexes of the table More... | |
void | set_instant_nullable (uint16_t n) |
Set instant nullable. More... | |
uint16_t | get_instant_nullable () const |
Get instant nullable. More... | |
uint16_t | get_nullable_before_instant_add_drop () const |
Get the nullable fields before any INSTANT ADD/DROP. More... | |
bool | is_committed () const |
Determine if the index has been committed to the data dictionary. More... | |
void | set_committed (bool committed) |
Flag an index committed or uncommitted. More... | |
const dict_index_t * | next () const |
Get the next index. More... | |
dict_index_t * | next () |
Get the next index. More... | |
bool | is_corrupted () const |
Check whether the index is corrupted. More... | |
bool | is_clustered () const |
bool | is_multi_value () const |
Check whether the index is the multi-value index. More... | |
ulint | get_min_size () const |
Returns the minimum data size of an index record. More... | |
bool | is_usable (const trx_t *trx) const |
Check whether index can be used by transaction. More... | |
bool | has_instant_cols () const |
Check whether index has any instantly added columns. More... | |
bool | has_row_versions () const |
Check whether index belongs to a table having row versions. More... | |
bool | has_instant_cols_or_row_versions () const |
check if either instant or versioned. More... | |
bool | is_tuple_instant_format (const uint16_t n_fields_in_tuple) const |
Check if tuple is having instant format. More... | |
uint32_t | get_n_nullable_before (uint32_t nth) const |
Returns the number of nullable fields before specified nth field. More... | |
uint32_t | get_n_total_fields () const |
Returns total fields including INSTANT DROP fields. More... | |
uint32_t | get_instant_fields () const |
Returns the number of fields before first instant ADD COLUMN. More... | |
size_t | calculate_n_instant_nullable (size_t _n_fields) const |
void | create_nullables (uint32_t current_row_version) |
Create nullables array. More... | |
uint32_t | get_nullable_in_version (uint8_t version) const |
Return nullable in a specific row version. More... | |
void | create_fields_array () |
Create fields array sorted by phy_pos of field in row. More... | |
void | destroy_fields_array () |
void | add_field (const char *name_arg, ulint prefix_len, bool is_ascending) |
Adds a field definition to an index. More... | |
dict_field_t * | get_physical_field (size_t pos) const |
Gets the nth physical pos field. More... | |
dict_field_t * | get_field (ulint pos) const |
Gets the nth field of an index. More... | |
uint16_t | get_logical_pos (uint16_t phy_pos) const |
Given the physical position, find the logical position of field. More... | |
uint16_t | get_field_off_pos (ulint pos) const |
Get the physical position of a field on a row. More... | |
uint16_t | get_field_phy_pos (ulint pos, uint8_t version) const |
const dict_col_t * | get_col (ulint pos) const |
Gets pointer to the nth column in an index. More... | |
ulint | get_col_no (ulint pos) const |
Gets the column number the nth field in an index. More... | |
ulint | get_sys_col_pos (ulint type) const |
Returns the position of a system column in an index. More... | |
ulint | get_col_pos (ulint n, bool inc_prefix=false, bool is_virtual=false) const |
Looks for column n in an index. More... | |
const byte * | get_nth_default (ulint nth, ulint *length) const |
Get the default value of nth field and its length if exists. More... | |
void | fill_srid_value (uint32_t srid_value, bool srid_is_valid_value) |
Sets srid and srid_is_valid values. More... | |
bool | is_compressed () const |
Check if the underlying table is compressed. More... | |
uint32_t | has_multi_value_col (const dict_v_col_t *mv_col) const |
Check if a multi-value index is built on specified multi-value virtual column. More... | |
page_size_t | get_page_size () const |
Get the page size of the tablespace to which this index belongs. More... | |
space_id_t | space_id () const |
Get the space id of the tablespace to which this index belongs. More... | |
Public Attributes | |
space_index_t | id |
id of the index More... | |
mem_heap_t * | heap |
memory heap More... | |
id_name_t | name |
index name More... | |
const char * | table_name |
table name More... | |
dict_table_t * | table |
back pointer to table More... | |
unsigned | space: 32 |
space where the index tree is placed More... | |
unsigned | page: 32 |
index tree root page number More... | |
unsigned | merge_threshold: 6 |
In the pessimistic delete, if the page data size drops below this limit in percent, merging it to a neighbor is tried. More... | |
unsigned | type: DICT_IT_BITS |
index type (DICT_CLUSTERED, DICT_UNIQUE, DICT_IBUF, DICT_CORRUPT) More... | |
unsigned | trx_id_offset: MAX_KEY_LENGTH_BITS |
position of the trx id column in a clustered index record, if the fields before it are known to be of a fixed size, 0 otherwise More... | |
unsigned | n_user_defined_cols: 10 |
number of columns the user defined to be in the index: in the internal representation we add more columns More... | |
unsigned | allow_duplicates: 1 |
if true, allow duplicate values even if index is created with unique constraint More... | |
unsigned | nulls_equal: 1 |
if true, SQL NULL == SQL NULL More... | |
unsigned | disable_ahi: 1 |
if true, then disable AHI. More... | |
unsigned | n_uniq: 10 |
number of fields from the beginning which are enough to determine an index entry uniquely More... | |
unsigned | n_def: 10 |
number of fields defined so far More... | |
unsigned | n_fields: 10 |
number of fields in the index More... | |
unsigned | n_total_fields: 10 |
number of total fields in the index (including INSTANT dropped fields) More... | |
unsigned | n_nullable: 10 |
number of nullable fields More... | |
unsigned | n_instant_nullable: 10 |
number of nullable fields before first instant ADD COLUMN applied to this table. More... | |
unsigned | cached: 1 |
true if the index object is in the dictionary cache More... | |
unsigned | to_be_dropped: 1 |
true if the index is to be dropped; protected by dict_operation_lock More... | |
unsigned | online_status: 2 |
enum online_index_status. More... | |
unsigned | uncommitted: 1 |
a flag that is set for secondary indexes that have not been committed to the data dictionary yet More... | |
unsigned | instant_cols: 1 |
true if the index is clustered index and it has some instant columns More... | |
unsigned | row_versions: 1 |
true if the index is clustered index and table has row versions More... | |
uint32_t | srid |
spatial reference id More... | |
bool | srid_is_valid |
says whether SRID is valid - it cane be undefined More... | |
std::unique_ptr< dd::Spatial_reference_system > | rtr_srs |
Cached spatial reference system dictionary entry used by R-tree indexes. More... | |
uint32_t | magic_n |
magic number More... | |
dict_field_t * | fields |
array of field descriptions More... | |
std::vector< uint16_t > | fields_array |
Array of field pos sorted as per their physical pos in record. More... | |
uint32_t | nullables [MAX_ROW_VERSION+1] = {0} |
Number of nullable columns in each version. More... | |
st_mysql_ftparser * | parser |
fulltext parser plugin More... | |
bool | is_ngram |
true if it's ngram parser More... | |
bool | has_new_v_col |
whether it has a newly added virtual column in ALTER More... | |
bool | hidden |
if the index is an hidden index More... | |
btr_search_t * | search_info |
info used in optimistic searches More... | |
row_log_t * | online_log |
the log of modifications during online index creation; valid when online_status is ONLINE_INDEX_CREATION More... | |
last_ops_cur_t * | last_ins_cur |
cache the last insert position. More... | |
last_ops_cur_t * | last_sel_cur |
cache the last selected position. More... | |
rec_cache_t | rec_cache |
cache the field that needs to be re-computed on each insert. More... | |
rtr_ssn_t | rtr_ssn |
Node sequence number for RTree. More... | |
rtr_info_track_t * | rtr_track |
tracking all R-Tree search cursors More... | |
trx_id_t | trx_id |
id of the transaction that created this index, or 0 if the index existed when InnoDB was started up More... | |
zip_pad_info_t | zip_pad |
Information about state of compression failures and successes. More... | |
rw_lock_t | lock |
read-write lock protecting the upper levels of the index tree More... | |
bool | fill_dd |
Flag whether need to fill dd tables when it's a fulltext index. More... | |
uint64_t * | stat_n_diff_key_vals |
Statistics for query optimization. More... | |
uint64_t * | stat_n_sample_sizes |
number of pages that were sampled to calculate each of stat_n_diff_key_vals[], e.g. More... | |
uint64_t * | stat_n_non_null_key_vals |
ulint | stat_index_size |
approximate index size in database pages More... | |
ulint | stat_n_leaf_pages |
approximate number of leaf pages in the index tree More... | |
Data structure for an index.
Most fields will be initialized to 0, NULL or false in dict_mem_index_create().
|
inline |
Adds a field definition to an index.
NOTE: does not take a copy of the column name if the field is a column. The memory occupied by the column name may be released only after publishing the index.
[in] | name_arg | column name |
[in] | prefix_len | 0 or the column prefix length in a MySQL index like INDEX (textcol(25)) |
[in] | is_ascending | true=ASC, false=DESC |
|
inline |
|
inline |
Create fields array sorted by phy_pos of field in row.
void dict_index_t::create_nullables | ( | uint32_t | current_row_version | ) |
Create nullables array.
[in] | current_row_version | current row version of table |
|
inline |
|
inline |
Sets srid and srid_is_valid values.
[in] | srid_value | value of SRID, may be garbage if srid_is_valid_value = false |
[in] | srid_is_valid_value | value of srid_is_valid |
|
inline |
Gets pointer to the nth column in an index.
[in] | pos | position of the field |
Gets the column number the nth field in an index.
[in] | pos | position of the field |
Looks for column n in an index.
[in] | n | column number |
[in] | inc_prefix | true=consider column prefixes too |
[in] | is_virtual | true==virtual column |
|
inline |
Gets the nth field of an index.
[in] | pos | position of field |
|
inline |
Get the physical position of a field on a row.
For table having INSTANT column, it might differ from field index (pos).
[in] | pos | field index |
|
inline |
|
inline |
Returns the number of fields before first instant ADD COLUMN.
This is needed only for V1 INSTANT ADD.
It includes dropped fields also (if any)
|
inline |
Get instant nullable.
|
inline |
Given the physical position, find the logical position of field.
[in] | phy_pos | physical position of field |
|
inline |
Returns the minimum data size of an index record.
|
inline |
Returns the number of nullable fields before specified nth field.
[in] | nth | nth field to check |
|
inline |
Returns total fields including INSTANT DROP fields.
Get the default value of nth field and its length if exists.
If not exists, both the return value is nullptr and length is 0.
[in] | nth | nth field to get |
[in,out] | length | length of the default value |
|
inline |
Get the nullable fields before any INSTANT ADD/DROP.
|
inline |
Return nullable in a specific row version.
page_size_t dict_index_t::get_page_size | ( | ) | const |
Get the page size of the tablespace to which this index belongs.
|
inline |
Gets the nth physical pos field.
[in] | pos | physical position of the field |
Returns the position of a system column in an index.
[in] | type | DATA_ROW_ID, ... |
|
inline |
Check whether index has any instantly added columns.
Possible only if table has INSTANT ADD columns and is upgraded.
|
inline |
check if either instant or versioned.
|
inline |
Check if a multi-value index is built on specified multi-value virtual column.
Please note that there could be only one multi-value virtual column on the multi-value index, but not necessary the first field of the index.
[in] | mv_col | multi-value virtual column |
|
inline |
Check whether index belongs to a table having row versions.
|
inline |
|
inline |
Determine if the index has been committed to the data dictionary.
|
inline |
Check if the underlying table is compressed.
|
inline |
Check whether the index is corrupted.
|
inline |
Check whether the index is the multi-value index.
bool dict_index_t::is_tuple_instant_format | ( | const uint16_t | n_fields_in_tuple | ) | const |
Check if tuple is having instant format.
[in] | n_fields_in_tuple | number of fields in tuple |
bool dict_index_t::is_usable | ( | const trx_t * | trx | ) | const |
Check whether index can be used by transaction.
[in] | trx | transaction |
|
inline |
Get the next index.
NULL | if this was the last index |
|
inline |
Get the next index.
NULL | if this was the last index |
|
inline |
Flag an index committed or uncommitted.
[in] | committed | whether the index is committed |
|
inline |
Set instant nullable.
[in] | n | nullable fields before first INSTANT ADD |
|
inline |
Get the space id of the tablespace to which this index belongs.
dict_index_t::UT_LIST_NODE_T | ( | dict_index_t | ) |
list of indexes of the table
unsigned dict_index_t::allow_duplicates |
if true, allow duplicate values even if index is created with unique constraint
unsigned dict_index_t::cached |
true if the index object is in the dictionary cache
unsigned dict_index_t::disable_ahi |
if true, then disable AHI.
Currently limited to intrinsic temporary table and SDI table as index id is not unique for such table which is one of the validation criterion for ahi.
dict_field_t* dict_index_t::fields |
array of field descriptions
std::vector<uint16_t> dict_index_t::fields_array |
Array of field pos sorted as per their physical pos in record.
Only needed for clustered index having INSTANT ADD/DROP columns.
bool dict_index_t::fill_dd |
Flag whether need to fill dd tables when it's a fulltext index.
bool dict_index_t::has_new_v_col |
whether it has a newly added virtual column in ALTER
mem_heap_t* dict_index_t::heap |
memory heap
bool dict_index_t::hidden |
if the index is an hidden index
space_index_t dict_index_t::id |
id of the index
unsigned dict_index_t::instant_cols |
true if the index is clustered index and it has some instant columns
bool dict_index_t::is_ngram |
true if it's ngram parser
last_ops_cur_t* dict_index_t::last_ins_cur |
cache the last insert position.
Currently limited to auto-generated clustered index on intrinsic table only.
last_ops_cur_t* dict_index_t::last_sel_cur |
cache the last selected position.
Currently limited to intrinsic table only.
rw_lock_t dict_index_t::lock |
read-write lock protecting the upper levels of the index tree
uint32_t dict_index_t::magic_n |
magic number
unsigned dict_index_t::merge_threshold |
In the pessimistic delete, if the page data size drops below this limit in percent, merging it to a neighbor is tried.
unsigned dict_index_t::n_def |
number of fields defined so far
unsigned dict_index_t::n_fields |
number of fields in the index
unsigned dict_index_t::n_instant_nullable |
number of nullable fields before first instant ADD COLUMN applied to this table.
This is valid only when has_instant_cols() is true
unsigned dict_index_t::n_nullable |
number of nullable fields
unsigned dict_index_t::n_total_fields |
number of total fields in the index (including INSTANT dropped fields)
unsigned dict_index_t::n_uniq |
number of fields from the beginning which are enough to determine an index entry uniquely
unsigned dict_index_t::n_user_defined_cols |
number of columns the user defined to be in the index: in the internal representation we add more columns
id_name_t dict_index_t::name |
index name
uint32_t dict_index_t::nullables[MAX_ROW_VERSION+1] = {0} |
Number of nullable columns in each version.
Only needed for clustered index having INSTANT ADD/DROP columns.
unsigned dict_index_t::nulls_equal |
if true, SQL NULL == SQL NULL
row_log_t* dict_index_t::online_log |
the log of modifications during online index creation; valid when online_status is ONLINE_INDEX_CREATION
unsigned dict_index_t::online_status |
enum online_index_status.
Transitions from ONLINE_INDEX_COMPLETE (to ONLINE_INDEX_CREATION) are protected by dict_operation_lock and dict_sys->mutex. Other changes are protected by index->lock.
unsigned dict_index_t::page |
index tree root page number
st_mysql_ftparser* dict_index_t::parser |
fulltext parser plugin
rec_cache_t dict_index_t::rec_cache |
cache the field that needs to be re-computed on each insert.
Limited to intrinsic table as this is common share and can't be used without protection if table is accessible to multiple-threads.
unsigned dict_index_t::row_versions |
true if the index is clustered index and table has row versions
std::unique_ptr<dd::Spatial_reference_system> dict_index_t::rtr_srs |
Cached spatial reference system dictionary entry used by R-tree indexes.
rtr_ssn_t dict_index_t::rtr_ssn |
Node sequence number for RTree.
rtr_info_track_t* dict_index_t::rtr_track |
tracking all R-Tree search cursors
btr_search_t* dict_index_t::search_info |
info used in optimistic searches
unsigned dict_index_t::space |
space where the index tree is placed
uint32_t dict_index_t::srid |
spatial reference id
bool dict_index_t::srid_is_valid |
says whether SRID is valid - it cane be undefined
ulint dict_index_t::stat_index_size |
approximate index size in database pages
uint64_t* dict_index_t::stat_n_diff_key_vals |
Statistics for query optimization.
approximate number of different key values for this index, for each n-column prefix where 1 <= n <= dict_get_n_unique(index) (the array is indexed from 0 to n_uniq-1); we periodically calculate new estimates
ulint dict_index_t::stat_n_leaf_pages |
approximate number of leaf pages in the index tree
uint64_t* dict_index_t::stat_n_non_null_key_vals |
uint64_t* dict_index_t::stat_n_sample_sizes |
number of pages that were sampled to calculate each of stat_n_diff_key_vals[], e.g.
stat_n_sample_sizes[3] pages were sampled to get the number stat_n_diff_key_vals[3].
dict_table_t* dict_index_t::table |
back pointer to table
const char* dict_index_t::table_name |
table name
unsigned dict_index_t::to_be_dropped |
true if the index is to be dropped; protected by dict_operation_lock
trx_id_t dict_index_t::trx_id |
id of the transaction that created this index, or 0 if the index existed when InnoDB was started up
unsigned dict_index_t::trx_id_offset |
position of the trx id column in a clustered index record, if the fields before it are known to be of a fixed size, 0 otherwise
unsigned dict_index_t::type |
index type (DICT_CLUSTERED, DICT_UNIQUE, DICT_IBUF, DICT_CORRUPT)
unsigned dict_index_t::uncommitted |
a flag that is set for secondary indexes that have not been committed to the data dictionary yet
zip_pad_info_t dict_index_t::zip_pad |
Information about state of compression failures and successes.