diff options
| author | Monty <monty@mariadb.org> | 2023-01-10 15:37:28 +0200 |
|---|---|---|
| committer | Monty <monty@mariadb.org> | 2023-02-10 12:59:36 +0200 |
| commit | 3316a54db3df9b50596cceab5164af5ef74efabd (patch) | |
| tree | cff4ffc7ada574bc462defb6d121e8dc986cbf05 /sql/sql_join_cache.cc | |
| parent | 65da5645305ee3b5d49c571314b832059bace09c (diff) | |
| download | mariadb-git-3316a54db3df9b50596cceab5164af5ef74efabd.tar.gz | |
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()
Diffstat (limited to 'sql/sql_join_cache.cc')
| -rw-r--r-- | sql/sql_join_cache.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc index 27eb9a0c83e..510e71a36ee 100644 --- a/sql/sql_join_cache.cc +++ b/sql/sql_join_cache.cc @@ -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()))) |
