Not the answer you need?
Register and ask your own question!

alter table or new table : a design puzzle

iexploremysqliexploremysql EntrantInactive User Role Beginner
This is a problem that bothers me whenever there is a need to add a new field to a table. Here the table has got about 1.5 Billion records (partitioned and sharded so it is physically separated files). Now I need to add a nullable field which is varchar(1024), which is going to accept some json strings. Here are the arguments
  1. All existing rows will have null values for this field. (fav. new table)
  2. Only 5% of the newly inserted records will have value for this. (fav. new table )
  3. Most of the current queries on the table will need to access this field. (fav. alter)
Now should I add to current table, or define another table with same primary keys to store this data. Your comments would help a decision. Thanks
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.