Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: Cannot use AOST on the select query of an insert #30534

Closed
bladefist opened this issue Sep 23, 2018 · 8 comments
Closed

sql: Cannot use AOST on the select query of an insert #30534

bladefist opened this issue Sep 23, 2018 · 8 comments
Labels
A-sql-execution Relating to SQL execution. A-sql-mutations Mutation statements: UPDATE/INSERT/UPSERT/DELETE. A-sql-optimizer SQL logical planning and optimizations. C-wishlist A wishlist feature. docs-done docs-known-limitation T-sql-queries SQL Queries Team
Milestone

Comments

@bladefist
Copy link

bladefist commented Sep 23, 2018

Cockroach 2.1 Sept 17th.

insert into Table(cols) select cols from table2 as of system time '-1m' where -something- fails with:

pq: AS OF SYSTEM TIME must be provided on a top-level statement.

It would be useful to do this so you could do a large table copy as a non-blocking/locking statement.

Thanks.

Epic: CRDB-9838

Jira issue: CRDB-4829

@maddyblue
Copy link
Contributor

This is tricky due to the AOST implementation and can't be done right now. We've discussed this lots before but have no specific plans to implement it anytime soon. The best thing you can do now is SELECT ... AOST ... into a CSV file and then IMPORT that CSV.

@bladefist
Copy link
Author

Alright. But w/ the snapshop isolation being deprecated, was told AOST was the way to do non-blocking queries. It's just so incredibly limiting in where you can use AOST.

@knz knz added C-wishlist A wishlist feature. A-sql-optimizer SQL logical planning and optimizations. A-sql-execution Relating to SQL execution. labels Oct 3, 2018
@knz knz added this to the Later milestone Oct 3, 2018
@knz
Copy link
Contributor

knz commented Oct 3, 2018

@awoods187 can you check where this would fit on the roadmap? I know other users have asked before.

@knz
Copy link
Contributor

knz commented Oct 3, 2018

cc @rolandcrosby I think you may have an opinion too

@knz knz added the A-sql-mutations Mutation statements: UPDATE/INSERT/UPSERT/DELETE. label Oct 3, 2018
@knz knz assigned awoods187 and unassigned maddyblue Oct 3, 2018
@sploiselle
Copy link
Contributor

@mjibson Can I get you to draft a short blurb describing this known limitation for the 2.1 known limitation page? Posting it on this issue and/or pinging me would be great.

@maddyblue
Copy link
Contributor

AS OF SYSTEM TIME can only be used in a top-level SELECT statement. That is, we do not support statements like INSERT INTO t SELECT * FROM t2 AS OF SYSTEM TIME <time> or two subselects in the same statement with differing AS OF SYSTEM TIME arguments.

@rmloveland
Copy link
Collaborator

I just created cockroachdb/docs#6224 which seems to be related to this

@awoods187 awoods187 removed their assignment Mar 25, 2020
@jlinder jlinder added the T-sql-queries SQL Queries Team label Jun 16, 2021
@irfansharif
Copy link
Contributor

Duplicate #35712.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-execution Relating to SQL execution. A-sql-mutations Mutation statements: UPDATE/INSERT/UPSERT/DELETE. A-sql-optimizer SQL logical planning and optimizations. C-wishlist A wishlist feature. docs-done docs-known-limitation T-sql-queries SQL Queries Team
Projects
None yet
Development

No branches or pull requests

9 participants