-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: add primary key on empty table very slow #47607
Comments
Hello, I am Blathers. I am here to help you get the issue triaged. Hoot - a bug! Though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here. I have CC'd a few people who may be able to assist you: 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
As the notice says, there is asynchronous work after adding a primary key that is happening in the background, which is delaying the constraint add from completing. If you put the create + add pk + add constraint into a transaction it will complete immediately. i.e.
|
we should look into this because i imagine this is common behavior in test suites in which a PK is a logical and not a physical grouping for Postgres and is not created implicitly. |
i suspect #47624 may help |
Describe the problem
discover while trying reproduce #47512
To Reproduce
cockroach start-single-node --insecure
(empty data)create_users_table.sql
with content followcockroach sql --insecure < create_users_table.sql
It take a whooping 30s to add primary key on empty table (╯°□°)╯︵ ┻━┻
Expected behavior
Should be much faster since the table is empty.
Environment:
cockroach sql
(same version as server)The text was updated successfully, but these errors were encountered: