MCPcopy Create free account
hub / github.com/MariaDB/server / init_join_cache_and_keyread

Method init_join_cache_and_keyread

sql/sql_select.cc:34334–34459  ·  view source on GitHub ↗

@brief Initialize join cache and enable keyread */

Source from the content-addressed store, hash-verified

34332 Initialize join cache and enable keyread
34333*/
34334void JOIN::init_join_cache_and_keyread()
34335{
34336 JOIN_TAB *tab;
34337 for (tab= first_linear_tab(this, WITH_BUSH_ROOTS, WITHOUT_CONST_TABLES);
34338 tab;
34339 tab= next_linear_tab(this, tab, WITH_BUSH_ROOTS))
34340 {
34341 TABLE *table= tab->table;
34342 switch (tab->type) {
34343 case JT_SYSTEM:
34344 case JT_CONST:
34345 case JT_FT:
34346 case JT_UNKNOWN:
34347 case JT_MAYBE_REF:
34348 break;
34349 case JT_EQ_REF:
34350 case JT_REF_OR_NULL:
34351 case JT_REF:
34352 if (table->covering_keys.is_set(tab->ref.key) && !table->no_keyread)
34353 table->file->ha_start_keyread(tab->ref.key);
34354 break;
34355 case JT_HASH:
34356 case JT_ALL:
34357 case JT_RANGE:
34358 SQL_SELECT *select;
34359 select= tab->select ? tab->select :
34360 (tab->filesort ? tab->filesort->select : NULL);
34361 if (select && select->quick && select->quick->index != MAX_KEY &&
34362 table->covering_keys.is_set(select->quick->index) &&
34363 !table->no_keyread)
34364 table->file->ha_start_keyread(select->quick->index);
34365 break;
34366 case JT_HASH_NEXT:
34367 case JT_NEXT:
34368 if ((tab->read_first_record == join_read_first ||
34369 tab->read_first_record == join_read_last) &&
34370 table->covering_keys.is_set(tab->index) &&
34371 !table->no_keyread)
34372 {
34373 DBUG_ASSERT(!tab->filesort);
34374 table->file->ha_start_keyread(tab->index);
34375 }
34376 break;
34377 default:
34378 break;
34379 /* purecov: end */
34380 }
34381
34382 if (table->file->keyread_enabled() &&
34383 !table->is_clustering_key(table->file->keyread))
34384 {
34385 /*
34386 Here we set the read_set bitmap for all covering keys
34387 except CLUSTERED indexes, with all the key-parts inside the key.
34388 This is needed specifically for an index that contains virtual column.
34389
34390 Example:
34391 Lets say we have this query

Callers

nothing calls this directly

Calls 11

first_linear_tabFunction · 0.85
next_linear_tabFunction · 0.85
bitmap_set_bitFunction · 0.85
revise_cache_usageFunction · 0.85
ha_start_keyreadMethod · 0.80
keyread_enabledMethod · 0.80
is_clustering_keyMethod · 0.80
mark_index_columnsMethod · 0.80
is_setMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected