VARCHAR vs TEXT performance when data fits on row

前端 未结 4 1425
面向向阳花
面向向阳花 2020-12-30 10:40
mysql> desc temp1;
+-------+--------------+------+-----+---------+-------+
| Field | Type         | Null | Key | Default | Extra |
+-------+--------------+------+         


        
4条回答
  •  滥情空心
    2020-12-30 11:05

    With respect to storage, InnoDB will handle VARCHAR and TEXT much the same when both stored inline. However, when fetching the data from InnoDB, the server will allocate space for all VARCHAR columns before query execution. While space for TEXT columns will only be allocated if they are actually read, where DYNAMIC memory allocation takes time.

    https://forums.mysql.com/read.php?24,645115,645164#msg-645164

提交回复
热议问题