1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Code cleanups and add some caching of functions to speed up things

Detailed description:
- Added more function comments and fixed types in some old comments
- Removed an outdated comment
- Cleaned up some functions in records.cc
  - Replaced "while" with "if"
  - Reused error code
  - Made functions similar
- Added caching of pfs_batch_update()
- Simplified some rowid_filter code
  - Only call build_range_rowid_filter() if rowid filter will be used
  - Replaced tab->is_rowid_filter_built with need_to_build_rowid_filter.
    We only have to test need_to_build_rowid_filter to know if we have
    to build the filter. Old code needed two tests
  - Added function 'clear_range_rowid_filter' to disable rowid filter.
    Made things simpler as we can now clear all rowid filter variables
    in one place.
- Removed some 'if' in sub_select()
This commit is contained in:
Monty
2023-01-10 15:37:28 +02:00
parent 65da564530
commit 3316a54db3
4 changed files with 164 additions and 100 deletions

View File

@@ -2146,12 +2146,12 @@ enum_nested_loop_state JOIN_CACHE::join_records(bool skip_last)
if (!join_tab->first_unmatched)
{
bool pfs_batch_update= join_tab->pfs_batch_update(join);
if (pfs_batch_update)
DBUG_ASSERT(join_tab->cached_pfs_batch_update == join_tab->pfs_batch_update());
if (join_tab->cached_pfs_batch_update)
join_tab->table->file->start_psi_batch_mode();
/* Find all records from join_tab that match records from join buffer */
rc= join_matching_records(skip_last);
if (pfs_batch_update)
if (join_tab->cached_pfs_batch_update)
join_tab->table->file->end_psi_batch_mode();
if (rc != NESTED_LOOP_OK && rc != NESTED_LOOP_NO_MORE_ROWS)
goto finish;
@@ -2321,7 +2321,8 @@ enum_nested_loop_state JOIN_CACHE::join_matching_records(bool skip_last)
if ((rc= join_tab_execution_startup(join_tab)) < 0)
goto finish2;
join_tab->build_range_rowid_filter_if_needed();
if (join_tab->need_to_build_rowid_filter)
join_tab->build_range_rowid_filter();
/* Prepare to retrieve all records of the joined table */
if (unlikely((error= join_tab_scan->open())))