Skip to content

Updating single links with linkprops don't use index for target #9035

@dnwpark

Description

@dnwpark

Given the schema:

global N: int64;

type Target;
type Source {
    target: Target {
        lprop: int64;
    };
};

And setup:

insert Target;
with x := (
    for _ in array_unpack(array_fill(0, N))
        insert Source { target := (select Target limit 1) }
    )
select count(x);

The following query:

update Source
set {
    target := (select Target limit 1)
};

takes a nonlinear (quadratic?) amount of time:

N time (ms)
10000 7133.4
20000 30564.3
30000 75512.4

After inserting 100 more Sources,

for _ in array_unpack(array_fill(0, 100))
    insert Source { target := (select Target limit 1) };

The following query, with the new ids as $0:

for s in std::array_unpack(<array<std::uuid>>$0) union ((
    update <Source>s
    set { target := {} }
));

takes an increasing amount of time:

N time (ms)
100000 1163.2
200000 7941.1
300000 11526.2

Analyzing both queries shows the majority of time spent in ModifyTable relation_name=Source_05, possibly as a result of a HashJoin join_type=Inner.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions