Skip to content

Performance: pushDerived should use IsSingleShard() check #18952

@arthurschreiber

Description

@arthurschreiber

Overview of the Issue

pushDerived in go/vt/vtgate/planbuilder/operators/route_planning.go currently uses an explicit check for engine.EqualUnique opcodes, which means that other single shard routing opcodes will not be merged together.

Using isSingleShard() would allow more queries to be merged and pushed down to MySQL.

An example query that wouldn't be merged today would be an outer query targeting a sharded keyspace, containing a subquery that's comprised of a union of two or more queries that fetch data from an unsharded keyspace. In this case, the inner UNION would be mergeable, but won't be merged together today.

Reproduction Steps

n/a

Binary Version

n/a

Operating System and Environment details

n/a

Log Fragments

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageThis issue needs to be correctly labelled and triagedType: Bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions