-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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: encountered pq: command is too large for CREATE TABLE AS and INSERT INTO ... SELECT operations #25828
Comments
The root cause of this issue is the limit on transaction size.
|
cc @tschottdorf @danhhz - perhaps there's a fancier way to do this with SSTable rewriting? |
Note that the transaction size limit has been significantly raised in 2.0, but CREATE TABLE AS runs into the (much smaller) command size limit. A transactional CREATE TABLE AS that splits its work into multiple KV-level commands would be able to handle larger tables (although it would still be slower than using the export/import machinery). |
Adjusted the title to make this easier to search for. |
So Please confirm CTAS or CTAS with 1=2 and IAS would be the same issue.. I am sure of it - just want to confirm. |
Docs currently suggest this is fixed, but per cockroachdb/cockroach#25828 it still applies to INSERT INTO... SELECT FROM and CREATE TABLE AS SELECT statements.
This is still an issue in 2.1, per cockroachdb/cockroach#25828
@awoods187 @jordanlewis @rolandcrosby
The migration to a job would imply that the table created by CTAS would not be usable within the same txn, as jobs are only processed following a commit. Just wanted to run this by the Execution team before any dev work is started. |
CTAS was initially planned and executed in the same user transaction. As a first step in improving its performance and scalability (issue cockroachdb#25828) we needed to split the responsibility of creating a new TableDescriptor, and executing the AS query. While the user txn continues to create and store the new desc, the execution has been made async by moving the logic to the SchemaChanger. This requires the SchemaChanger to be able to bootstrap its state from the desc it reads, thereby requiring the addition of these fields. Release note: None
CTAS was initially planned and executed in the same user transaction. As a first step in improving its performance and scalability (issue cockroachdb#25828) we needed to split the responsibility of creating a new TableDescriptor, and executing the AS query. While the user txn continues to create and store the new desc, the execution has been made async by moving the logic to the SchemaChanger. This requires the SchemaChanger to be able to bootstrap its state from the desc it reads, thereby requiring the addition of these fields. Release note: None
CTAS was initially planned and executed in the same user transaction. As a first step in improving its performance and scalability (issue cockroachdb#25828) we needed to split the responsibility of creating a new TableDescriptor, and executing the AS query. While the user txn continues to create and store the new desc, the execution has been made async by moving the logic to the SchemaChanger. This requires the SchemaChanger to be able to bootstrap its state from the desc it reads, thereby requiring the addition of these fields. Release note: None
38061: pkg: Split CTAS execution between user txn and SchemaChanger. r=adityamaru27 a=adityamaru27 As a first step in improving the performance and scalability of the `CTAS` command, (issue #25828) we needed to split the responsibility of creating a new `TableDescriptor`, and executing the `AS` query to backfill the new table. While the user txn continues to create and store the new desc, the execution of the `AS` query has been made async by moving the logic to the SchemaChanger. Co-authored-by: Aditya Maru <[email protected]>
With #38374 now merged, I ran a benchmark on a 4 node default configuration cluster to compare CTAS performance in the Average over 5 runs: I then tested the new implementation with source tables of varying sizes all the way up to a 25 GiB, 50 million row table which it completed in 18m14s. |
This is awesome @adityamaru27! I am super psyched about it. |
Very nice work @adityamaru27. |
Created 2 column table with 2.7M rows and tried to CTAS from primary table to new table and encountered the following issue.
The text was updated successfully, but these errors were encountered: