在 MySQL 中更改 max_heap_table_size 值?
max_heap_table_size 是一個既有讀許可權又有寫許可權的系統變數。
最初,max_heap_table_size 大小為 16 MB。首先,檢查 max_heap_table_size 的值,以位元組為單位。
查詢如下 −
mysql> select @@max_heap_table_size;
以下是輸出 −
+-----------------------+ | @@max_heap_table_size | +-----------------------+ | 16777216 | +-----------------------+ 1 row in set (0.00 sec)
現在讓我們看看值 16777216 位元組 = 16 MB −
1 MB = 1024KB 1KB = 1024 Bytes 1MB = 1024*1024 bytes. To convert 16777216 byte to MB you need to divide 1024*1024. =16777216/(1024*1024) =16777216/1048576 =16 MB
現在,你可以使用 SET 命令更改 max_heap_table_size。語法如下 −
SET @@@@max_heap_table_size=yourNumberOfBytes.
讓我們更改 max_heap_table_size 值。位元組數為 33554432,等於 32 MB。
查詢如下 −
mysql> set @@max_heap_table_size=33554432; Query OK, 0 rows affected (0.00 sec)
現在檢查 @@max_heap_table_size 的值。查詢如下 −
mysql> select @@max_heap_table_size;
以下是輸出 −
+-----------------------+ | @@max_heap_table_size | +-----------------------+ | 33554432 | +-----------------------+ 1 row in set (0.00 sec)
讓我們看看它是否等於 32MB。這裡使用的公式如上所述 −
mysql> select @@max_heap_table_size/1048576 as MB;
以下是輸出 −
+---------+ | MB | +---------+ | 32.0000 | +---------+ 1 row in set (0.00 sec)
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP