Renaming the 100GB Table
I ha开发者_运维知识库ve more than 100GB size of table in my database I want to rename the table name. Is it a good idea?
Is not a problem at all! Problem if you would change a column. Make sure nobody refers to the old name.
Depends upon your version of mysql. Version 5.1 and 5.5 can do a rename by altering the .frm file and renaming the file. I'm not sure about earlier versions. Be careful of other alter table commands because it may need to create a copy of the table data.
Edit: This is also dependent upon the MySQL storage engine as well. MyISAM and InnoDB tables can be renamed by changing the metadata (i.e renaming the file). But there are some storage engines which will perform the copy operation to do something as simple as a table rename.
Yes. There is no dependency between the size and the name. If you don't have to change the queries in your code or stored procedures, you are good to go.
After changing several table names to follow the current naming standards we found a legacy program which had the table name hard coded and had to change everything back. To comply with the naming standard for the new app being build we created a view for each offending table with the current naming standard.
Ideally, it should never ever create a problem. The name of the table should not have any dependencies on what the contents of the same table are. Unless you are trying to mess with system tables, in which case the results are not going to be pretty.
精彩评论