Esta página aún no está disponible en su idioma local. Estamos trabajando arduamente para agregar más versiones de idiomas. Gracias por tu apoyo.

On this page

Online Varchar Length Increase

Updated on 2023-08-21 GMT+08:00

Introduction

Varchar is a set of character data. The native MySQL only supports varchar whose length is no more than 256 bytes. To increase its length to more than 256 bytes, copy data to new tables and lock the tables to prevent data writes during the length increase. RDS for MySQL has no limitations on the varchar length and allows you to increase it online.

Constraints

This function is available only in RDS for MySQL 5.6 (kernel version 5.6.46 or later) and 5.7 (kernel version 5.7.27 or later).

Category

  • Increase the varchar length to no more than 256 bytes.
    create table t1(a varchar(10));
    Query OK, 0 rows affected (0.03 sec)
    alter table t1 modify a varchar(100),ALGORITHM=INPLACE, LOCK=NONE;
    Query OK, 0 rows affected (0.06 sec)
    Records: 0  Duplicates: 0  Warning: 0
  • Increase the varchar length from less than 256 bytes to more than 256 bytes.
    create table t1(a varchar(100));
    Query OK, 0 rows affected (0.05 sec)
    alter table t1 modify a varchar(300),ALGORITHM=INPLACE, LOCK=NONE;
    Query OK, 0 rows affected (0.11 sec)
    Records: 0  Duplicates: 0  Warning: 0
  • Increase the varchar length beyond 256 bytes.
    create table t1(a varchar(300));
    Query OK, 0 rows affected (0.08 sec)
    alter table t1 modify a varchar(500),ALGORITHM=INPLACE, LOCK=NONE;
    Query OK, 0 rows affected (0.06 sec)
    Records: 0  Duplicates: 0  Warning: 0
Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback