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

Don't apply defaults to all rows when the added column has no default #855

Merged
merged 2 commits into from
Mar 8, 2022

Conversation

druvv
Copy link
Contributor

@druvv druvv commented Mar 8, 2022

Related to dolthub/dolt#2939

When a user was working with a large table, adding a column with no default caused an OOM crash. The crash is a result of the ADD COLUMN sql statement causing every row to be modified in the table. This is not-expected and a bug. We expect adding a column with no default to only modify the schema and not any Dolt row.

The fix is to skip applying defaults to table if the added column has no default. We can call this a "fast" add column since only the schema has to be modified.

In the future, we may also add a "fast" drop column where only the schema is modified. Currently, we modify every row for a DROP COLUMN statement. In the "fast" drop scenario, it might be important to ensure values aren't retained across ADD COLUMN and DROP COLUMN statements with the same column name. This PR also adds tests to ensure this.

Copy link
Contributor

@VinaiRachakonda VinaiRachakonda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants