-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: support different AS OF SYSTEM TIME timestamps inside a single statement #35712
Copy link
Copy link
Open
Labels
A-sql-executionRelating to SQL execution.Relating to SQL execution.A-sql-optimizerSQL logical planning and optimizations.SQL logical planning and optimizations.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-sql-queriesSQL Queries TeamSQL Queries TeamX-anchored-telemetryThe issue number is anchored by telemetry references.The issue number is anchored by telemetry references.
Description
Desired feature:
SELECT * FROM t AS OF SYSTEM TIME '-1h', u AS OF SYSTEM TIME '-2h'
Or, more usefully:
INSERT INTO t1 SELECT * FROM t2 AS OF SYSTEM TIME '-1h'
CREATE TABLE t AS SELECT * FROM t AS OF SYSTEM TIME '-1h'
Update: #142147 has addressed this specifically for CREATE TABLE AS statements.
The idea here is that currently, the same client.Txn object is used for an entire statement, but there is no reason why this should remain true.
Single read-only relational nodes, especially table readers, could use a different Txn object with a historical timestamp.
Epic: CRDB-9838
Jira issue: CRDB-4561
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sql-executionRelating to SQL execution.Relating to SQL execution.A-sql-optimizerSQL logical planning and optimizations.SQL logical planning and optimizations.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-sql-queriesSQL Queries TeamSQL Queries TeamX-anchored-telemetryThe issue number is anchored by telemetry references.The issue number is anchored by telemetry references.
Type
Projects
Status
Backlog