Details
-
Task
-
Status: In Review (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
Address optimizer issues in the current patch for MDEV-25848 (https://github.com/MariaDB/server/pull/5841)
1. Memory consumption in the range optimizer
In current patch for MDEV-25848, every SEL_TREE object allocates SEL_TREE::keys to accomodate MAX_KEY elements:
/* in class SEL_TREE: */
|
SEL_TREE(enum Type type_arg, MEM_ROOT *root) |
: type(type_arg), keys(root, MAX_KEY), n_ror_scans(0)
|
{
|
keys_map.clear_all();
|
}
|
Note that there was a commit in the past that removed that:
commit 016790403a4bb6182094870870ce1a1c3e2756dc
|
Author: Sergei Petrunia <psergey@askmonty.org>
|
Date: Tue May 31 17:59:04 2016 +0300
|
 |
MDEV-9764: MariaDB does not limit memory used for range optimization
|
...
|
The idea here is to make SEL_TREE::keys to allocate only as much space as necessary when param->keys doesn't include any MVI or GIS indexes.
2. Add support for JSON_OVERLAPS and JSON_CONTAINS
Currently the patch only supports MEMBER OF.
Note that it does support AND/OR of MEMBER OF.
Make JSON_OVERLAPS generate the same SEL_ARG/SEL_TREE structures as would be generated for disjunction of MEMBER OF conditions.
Make JSON_CONTAINS ... the same .. as conjunction of MEMBER OF conditions.
3 Discuss ROR-ness of MVI index reads..
MVI index is defined as:
const char templ[]="CREATE TABLE i ( "
|
" typ tinyint unsigned not null, "
|
" value varbinary("
|
STRINGIFY_ARG(JSON_INDEX_VALUE_MAX_LEN) "),"
|
" tref varbinary(%u), "
|
" PRIMARY KEY (typ,value,tref)) ";
|
This means that reading trefs for
'value1' MEMBER OF (json_col)
|
will produce tref values ordered according to tref varbinary(%u) ordering.
Which means that reading records for
'value1' MEMBER OF (json_col) OR
|
'value2' MEMBER OF (json_col)
|
could be done by merging two ordered streams.
QUICK_ROR_UNION_SELECT merges two "rowid ordered" streams. The problem here is that "rowid ordered" is defined as "ordered by handler->cmp_ref(r1, t2)" which may be different from "tref varbinary(%u) ordering".
Questions:
- Do we want to use QUICK_ROR_UNION_SELECT's algorithm for reading? (it has some extra startup costs due to need to do simultaneous scans)
- Do we need to switch from using tref varbinary(%u) to something that matches the rowid ordering in the primary table?
For example, if the primary table is InnoDB, and has PK defined aspk VARCHAR(100) collate utf8_unicode_ci PRIMARY KEY
should we then use the same in the secondary table for tref ?
Attachments
Issue Links
- split from
-
MDEV-25848 Support for Multi-Valued Indexes
-
- Stalled
-