diff options
author | Monty <monty@mariadb.org> | 2022-12-20 15:55:40 +0200 |
---|---|---|
committer | Sergei Petrunia <sergey@mariadb.com> | 2023-02-03 14:38:26 +0300 |
commit | ed0a72356691bdeb163b52fb73bd0afa7b9254ac (patch) | |
tree | 2562a6cdddca6e3c606cc5588598841af423b3d1 /sql/sql_class.h | |
parent | 5e0832e1321391f3e780280668e8ef3ac6db99bd (diff) | |
download | mariadb-git-ed0a72356691bdeb163b52fb73bd0afa7b9254ac.tar.gz |
Cache file->index_flags(index, 0, 1) in table->key_info[index].index_flags
The reason for this is that we call file->index_flags(index, 0, 1)
multiple times in best_access_patch()when optimizing a table.
For example, in InnoDB, the calls is not trivial (4 if's and 2 assignments)
Now the function is inlined and is just a memory reference.
Other things:
- handler::is_clustering_key() and pk_is_clustering_key() are now inline.
- Added TABLE::can_use_rowid_filter() to simplify some code.
- Test if we should use a rowid_filter only if can_use_rowid_filter() is
true.
- Added TABLE::is_clustering_key() to avoid a memory reference.
- Simplify some code using the fact that HA_KEYREAD_ONLY is true implies
that HA_CLUSTERED_INDEX is false.
- Added DBUG_ASSERT to TABLE::best_range_rowid_filter() to ensure we
do not call it with a clustering key.
- Reorginized elements in struct st_key to get better memory alignment.
- Updated ha_innobase::index_flags() to not have
HA_DO_RANGE_FILTER_PUSHDOWN for clustered index
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r-- | sql/sql_class.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index 95cf1275ee1..10f67fe0777 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -7430,6 +7430,21 @@ inline void handler::set_table(TABLE* table_arg) costs= &table_arg->s->optimizer_costs; } +inline bool handler::pk_is_clustering_key(uint index) const +{ + /* + We have to check for MAX_INDEX as table->s->primary_key can be + MAX_KEY in the case where there is no primary key. + */ + return index != MAX_KEY && is_clustering_key(index); +} + +inline bool handler::is_clustering_key(uint index) const +{ + DBUG_ASSERT(index != MAX_KEY); + return table->is_clustering_key(index); +} + inline int handler::ha_ft_read(uchar *buf) { int error= ft_read(buf); |