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

[feat]: Right Click - Rename Clustering Column on Table #614

Open
millerjp opened this issue Dec 10, 2024 · 0 comments
Open

[feat]: Right Click - Rename Clustering Column on Table #614

millerjp opened this issue Dec 10, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request right click
Milestone

Comments

@millerjp
Copy link
Contributor

millerjp commented Dec 10, 2024

Cassandra supports renaming columns under certain circumstances. Essentually you can rename clustering columns ONLY.
The following restrictions apply to RENAME:

  • You can only rename clustering columns, which are part of the primary key.
  • You can not rename columns on tables with secondary indexes
  • You can not rename columns on tables with materialised views

Allow users to right click on a clustering column to rename it when appropriate

Display a warning in the UX

Warning: Renaming columns can break existing queries and applications. Ensure you update all references and test thoroughly.

The reason you can only rename clustering columns in Cassandra is due to the immutability of SSTables. Here's why:

  • SSTable Immutability: Cassandra's data storage is based on immutable SSTables (Sorted String Tables). Once data is written to an SSTable, it cannot be modified in place. Any changes to the data structure, including renaming columns, require rewriting the entire SSTable.

  • Clustering Columns: Clustering columns are part of the primary key, which defines the physical order of data within a partition. Renaming clustering columns does not change the underlying data structure significantly because the data is still sorted by the same columns, just with a different name. This operation can be performed by rewriting the metadata without affecting the data on disk.

  • Non-Primary Key Columns: Ordinary columns, which are not part of the primary key, do not have the same constraints. Renaming these columns would require rewriting all the data in the SSTables, which is a resource-intensive operation. Cassandra avoids this by not allowing renaming of non-primary key columns to maintain performance and data integrity.

  • Performance and Data Integrity: Allowing renaming of non-primary key columns would lead to significant performance issues and potential data loss or corruption due to the need to rewrite all SSTables. By restricting renaming to clustering columns, Cassandra ensures that schema changes are manageable and do not compromise the database's performance or data integrity.

  • Application Compatibility: Renaming non-primary key columns could break existing queries, views, stored procedures, and application code, which rely on the original column names. By limiting renaming to clustering columns, Cassandra encourages developers to plan their schema changes carefully, reducing the risk of application compatibility issues.

@millerjp millerjp added enhancement New feature or request right click labels Dec 10, 2024
@millerjp millerjp added this to the RightClick milestone Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request right click
Projects
None yet
Development

No branches or pull requests

2 participants