Home Database Mysql Tutorial MySQL5.7加强了在线DDL(varchar字符集)

MySQL5.7加强了在线DDL(varchar字符集)

Jun 07, 2016 pm 02:53 PM
ddl varchar strengthen online character set

在MySQL5.6引入了在线DDL,添加字段和辅助索引不锁表,但修改字段属性是锁表的。请见:http://hcymysql.blog.51cto.com/5223301/1370546 如今在MySQL5.7,加强了修改varchar字段属性不锁表,例: 650) this.width=650;" src="http://www.68idc.cn/help/uploa

在MySQL5.6引入了在线DDL,添加字段和辅助索引不锁表,但修改字段属性是锁表的。请见:http://hcymysql.blog.51cto.com/5223301/1370546


如今在MySQL5.7,加强了修改varchar字段属性不锁表,例:

wKiom1RPWeKAI_hiAAK7Edk4nfs132.jpg


100万行的表,现在要把pad varchar(65)修改为pad varchar(80),可以看到,不用拷贝数据不锁表。

wKiom1RPWozBgsimAADG3ngstpM003.jpg

(注:ALGORITHM指定了创建或删除索引的算法,COPY表示按照MySQL 5.1版本之前的方法,即创建临时表。INPLACE表示创建索引或删除索引操作不需要创建临时表。DEFAULT表示根据参数old_alter_table来判断是通过INPLACE还是COPY的算法,改参数默认为OFF,表示采用INPLACE的方式。)


但如果是大于并等于varchar(256)或者把varchar(80)减少到varchar(40),仍旧是需要拷贝数据且锁表,见下图:

wKioL1RPW6XzYoWWAAEEOnV6HIg841.jpg

wKiom1RPXCqhVdI-AAEP5W8e2Pc967.jpg


参考:

wKiom1RPXGHw_vOAAAQrwxQQrc4177.jpg


BTW:

MySQL5.7还支持更改索引名,不过实用性不高,谁没事闲得改索引的名字?例:

wKioL1RPYh6D6x-jAAK-ZnVnN4A255.jpg

wKiom1RPYciRcsR-AAK5z6fs-bw004.jpg



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to develop an online restaurant reservation system using Laravel How to develop an online restaurant reservation system using Laravel Nov 02, 2023 pm 01:48 PM

How to use Laravel to develop an online restaurant reservation system In recent years, with the rapid development of the Internet and mobile Internet, online reservations have become an indispensable part of modern people's lives. The catering industry is no exception. More and more restaurants are beginning to provide online reservation services to improve user experience and expand market share. This article will introduce how to use the Laravel framework to develop a simple but fully functional online restaurant reservation system, and provide specific code examples to facilitate readers to learn and practice. Environment setup First, we need

Online Invoice Management System Development Guide in PHP Online Invoice Management System Development Guide in PHP Jun 11, 2023 am 08:38 AM

With the popularity of e-commerce, more and more businesses are adopting online invoice management systems to manage sales and invoices. When developing an online invoice management system, it is important to choose the right tools and technology. This article will introduce how to use PHP language to develop an online invoice management system and provide some useful development guidelines. Determine system requirements Before starting development, the specific requirements for an online invoice management system need to be determined. This may include the following aspects: Invoice management: saving, querying and editing invoice information; Customer information management: saving, querying and editing customers

How to use Java Websocket to implement online audio and video calls? How to use Java Websocket to implement online audio and video calls? Dec 02, 2023 am 09:44 AM

How to use JavaWebsocket to implement online audio and video calls? In today's digital age, real-time communication is becoming more and more common. Whether it is remote collaboration at work or remote communication with relatives and friends at home, real-time audio and video calls have become an indispensable part of people. This article will introduce how to use JavaWebsocket to implement online audio and video calls, and provide specific code examples. 1. Understand WebsocketWebsocket is a new technology in HTML5

What should I do if the microphone in Win10 cannot be pulled after being strengthened? What should I do if the microphone in Win10 cannot be pulled after being strengthened? Jul 05, 2023 pm 06:13 PM

What should I do if the Win10 microphone cannot be pulled up? Many friends often use microphones when using computers, and some users frequently fail to pull the microphone when preparing to strengthen the microphone. So what should we do when we encounter this situation? Let’s follow the editor to take a look at the solution to the problem that the Win10 microphone cannot be pulled up after being strengthened. Solution to Win10 Microphone Enhancement Unable to Pull: 1. You can try updating the driver again. 2. For systems above WIN7, right-click the recording device on the small speaker in the lower right corner to set the existing microphone as the default device during recording. Then double-click the microphone or click Properties in the level to adjust the microphone volume and microphone enhancement (this is adjusted appropriately, and it will be helpful to increase the volume).

How to implement a simple online music player using PHP How to implement a simple online music player using PHP Sep 24, 2023 pm 02:53 PM

How to use PHP to implement a simple online music player. With the advent of the digital age, more and more people are beginning to enjoy music through the Internet, and online music players have become an important tool. In this article, we will implement a simple online music player through the PHP programming language and provide specific code examples. Preparation work: Before starting, we need to prepare the following aspects: a machine running a web server (such as Apache). PHP running environment. Music files, music files can be

How to use Laravel to develop an online customer service system How to use Laravel to develop an online customer service system Nov 02, 2023 pm 02:48 PM

How to use Laravel to develop an online customer service system Introduction: Online customer service systems play an important role in modern enterprises. It helps businesses communicate with customers in real time, answer questions, provide support, and enhance user experience. This article will introduce how to use the Laravel framework to develop a simple and practical online customer service system. 1. Design the database The online customer service system needs to store users and conversation records, so it is first necessary to design a suitable database model. In Laravel we can use the migration tool

How to use PHP to implement a simple online event registration system How to use PHP to implement a simple online event registration system Sep 24, 2023 am 10:40 AM

How to use PHP to implement a simple online event registration system. With the rapid development of the Internet, more and more activities are beginning to manage the registration process through online registration systems, eliminating the trouble of traditional paper registration forms and manual processing. This article will introduce how to use PHP language to implement a simple online event registration system, and use specific code examples to help readers understand and practice. System Requirements Analysis Before developing a system, it is first necessary to clarify the requirements and functions of the system. According to the characteristics of the event registration system, we can determine the following

Detailed explanation of how to modify the character set of Oracle database Detailed explanation of how to modify the character set of Oracle database Mar 02, 2024 pm 03:18 PM

Detailed explanation of how to modify the character set of Oracle database Oracle database is a powerful relational database management system that supports multiple character sets, including Simplified Chinese character set, Traditional Chinese character set, English character set, etc. In practical applications, you may encounter situations where you need to modify the database character set. This article will introduce in detail the method of modifying the Oracle database character set and provide specific code examples for readers' reference. 1. Check the current database character set. Before modifying the database character set, you first need to check the current database character set.

See all articles