当前位置:网站首页>Mysql表数据比较大情况下怎么修改添加字段
Mysql表数据比较大情况下怎么修改添加字段
2022-06-30 02:38:00 【亿速云】
Mysql表数据比较大情况下怎么修改添加字段
这篇文章主要介绍了Mysql表数据比较大情况下怎么修改添加字段的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇Mysql表数据比较大情况下怎么修改添加字段文章都会有所收获,下面我们一起来看看吧。
前言
如果一张表在后期的维护中,发现需要加字段以满足当下的需求,但是数据量很大有百万甚至千万级的数据,要如何修改表字段呢。
直接执行使用alter语句肯定是不现实的,这涉及到锁表重建表结构等操作,假设这时候还有其他线程在跑,等一天都改不过来。
这里整理一个比较简单的方法
1、对照要操作的表结构创建一张临时表
CREATE TABLE product_copy LIKE product;
2、将要修改的表结构改在临时表上面
3、导出表product数据,并导入到零时表product_copy
4、使用RENAME语句替换表名
RENAME TABLE product TO product_bak, product_copy TO product;
但是数据量太大的情况下,导出导入也需要一定的时间,而且数据容易出错,这里推荐使用datagrip的导入导出工具,或者idea的数据源插件,最好使用csv文件来导入导出。
1、在表名处右击选择导入数据

2、在导入界面能清楚的看到字段的对应关系,有问题可以直接调整,所见即所得

3、如果导出的时候道出了表头,还可以在第一行右击将此行标记为表头,更方便看到数据的对应

关于“Mysql表数据比较大情况下怎么修改添加字段”这篇文章的内容就介绍到这里,感谢各位的阅读!相信大家对“Mysql表数据比较大情况下怎么修改添加字段”知识都有一定的了解,大家如果还想学习更多知识,欢迎关注亿速云行业资讯频道。
边栏推荐
- Entering Jiangsu writers and poets carmine Jasmine World Book Day
- Network neuroscience -- a review of network Neuroscience
- 福利抽奖 | 开源企业级监控Zabbix6.0都有哪些亮点
- Jupyter notebook displays a collection of K-line graphs
- Call collections Sort() method, compare two person objects (by age ratio first, and by name ratio for the same age), and pass lambda expression as a parameter.
- 速看 2021-2022年23项重大网络犯罪统计数据
- Two methods of SSL certificate format conversion
- How to prevent phishing emails? S/mime mail certificate
- NPDP产品经理国际认证考试报名有什么要求?
- SSL证书七大常见错误及解决方法
猜你喜欢

Bubble sort

如何在 JupyterLab 中把 ipykernel 切换到不同的 conda 虚拟环境?

Traffic, but no sales? 6 steps to increase website sales

AutoJS代碼能加密嗎?YES,AutoJS加密技巧展示

快速排序

Call collections Sort() method, compare two person objects (by age ratio first, and by name ratio for the same age), and pass lambda expression as a parameter.

Créer des compétences exquises dans l'éducation des créateurs

Linear algebra Chapter 3 summary of vector and vector space knowledge points (Jeff's self perception)

SiteLock九个常见问题

如何使用SMS向客户传递服务信息?指南在这里!
随机推荐
CMake教程系列-01-最小配置示例
C language pivot_ Invalid argument error resolution for root
FDA邮件安全解决方案
Time complexity analysis
代码签名、驱动签名的常见问题解答
What should academic presentation /ppt do?
JS advanced -es6 syntax
Template parameter package and function parameter package
Global and Chinese markets for wireless security in LTE networks 2022-2028: Research Report on technology, participants, trends, market size and share
Enlightenment from the revocation of Russian digital certificate by mainstream CA: upgrade the SSL certificate of state secret algorithm to help China's network security to be autonomous and controlla
Creating exquisite skills in maker Education
DigiCert Smart Seal是什么?
Select sort
LeetCode 3. 无重复字符的最长子串
Global and Chinese market of mobile commerce solutions 2022-2028: Research Report on technology, participants, trends, market size and share
Pytoch learning (II)
[dry goods sharing] the latest WHQL logo certification application process
c#控制台格式化代码
Steam elements hidden in science and Technology Education
多卡服务器使用