-
Notifications
You must be signed in to change notification settings - Fork 4.1k
storage: query hangs when using INSERT FROM ... SELECT on same table #28842
Copy link
Copy link
Closed
Labels
A-sql-executionRelating to SQL execution.Relating to SQL execution.A-sql-mutationsMutation statements: UPDATE/INSERT/UPSERT/DELETE.Mutation statements: UPDATE/INSERT/UPSERT/DELETE.C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code 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)Medium-low impact: incurs increased costs for some users (incl lower avail, recoverable bad data)
Milestone
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sql-executionRelating to SQL execution.Relating to SQL execution.A-sql-mutationsMutation statements: UPDATE/INSERT/UPSERT/DELETE.Mutation statements: UPDATE/INSERT/UPSERT/DELETE.C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code 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)Medium-low impact: incurs increased costs for some users (incl lower avail, recoverable bad data)