Skip to content

planner: support converting json_memberof/overlaps/contains to IndexMerge to access MVIndex #40191

@qw4990

Description

@qw4990

Enhancement

-- table with MVIndex
create table t (a json, b int, c int, index idx((cast(a->'$.zip' as signed array))), key(b), key(c)); 

-- json_memberof
select * from t where 1 member of (a)
-- IndexMerge(AND)
--     IndexRangeScan(a, [1,1])
--     TableRowIdScan(t)

-- json_contains
select * from t where json_contains(a, '[1, 2, 3]')
-- IndexMerge(AND)
--     IndexRangeScan(a, [1,1])
--     IndexRangeScan(a, [2,2])
--     IndexRangeScan(a, [3,3])
--     TableRowIdScan(t)


-- json_overlap	
select * from t where json_overlap(a, '[1, 2, 3]')
-- IndexMerge(OR)
--     IndexRangeScan(a, [1,1])
--     IndexRangeScan(a, [2,2])
--     IndexRangeScan(a, [3,3])
--     TableRowIdScan(t)

Metadata

Metadata

Assignees

Labels

sig/plannerSIG: Plannertype/enhancementThe issue or PR belongs to an enhancement.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions