Skip to content

storage: query hangs when using INSERT FROM ... SELECT on same table #28842

@solongordon

Description

@solongordon

If you select from a table and insert the results into the same table, the query never returns, provided the result set is sufficiently large.

To reproduce:

CREATE TABLE t (x INT);
INSERT INTO t SELECT generate_series(1, 25000);
INSERT INTO t SELECT * FROM t;

The last query never completes. Based on the logs, it seems like this happens when the insert is large enough to trigger a range split, and then it causes an endless cycle of range splits. The splits were a symptom, not the cause. See discussion below.

This issue is present in both 2.0 and 2.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-sql-executionRelating to SQL execution.A-sql-mutationsMutation statements: UPDATE/INSERT/UPSERT/DELETE.C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.S-3Medium-low impact: incurs increased costs for some users (incl lower avail, recoverable bad data)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions