��΄�(chu��ng)����(n��i)�����
��(chu��ng)����(n��i)����dz��ĺ�(ji��n)����ֻ��ע�� ENGINE= MEMORY ����:
CREATE TABLE `tablename` ( `columnName` varchar(256) NOT NUL) ENGINE=MEMORY DEFAULT CHARSET=latin1 MAX_ROWS=100000000;
ע�⣺
��(d��ng)��(n��i)����еĔ�(sh��)��(j��)����max_heap_table_size�O(sh��)����������С�r(sh��)��mysql��(hu��)�D(zhu��n)�Q�����Ĕ�(sh��)��(j��)�惦(ch��)���űP��������@�����ܾʹ���ۿ��ˣ��� ���҂�߀��Ҫ����(j��)�҂��Č�(sh��)�H��r�{(di��o)��max_heap_table_size��������.cnf�ļ���[mysqld]��������룺
max_heap_table_size = 2048M
�����ڽ����Z(y��)����߀����ͨ�^MAX_ROWS�����Ʊ���ӛ䛔�(sh��)��
��(n��i)���ʹ�ù�ϣɢ�������є�(sh��)��(j��)�����ڃ�(n��i)���У���˾��ИO����ٶȣ��m�Ͼ�����С�͔�(sh��)��(j��)��(k��)������ʹ�����ܵ�һЩ������
1��heap��(du��)�����Ñ����B���ǿ�Ҋ�����@ʹ�����dz��m�������档
2���H�m��ʹ�õĈ�(ch��ng)����heap�����Sʹ��xxxTEXT��xxxBLOB��(sh��)��(j��)�����ֻ���Sʹ��=��<=>������������ӛ� �������S<��>��<=��>=������֧��auto_increment��ֻ���S��(du��)�ǿՔ�(sh��)��(j��)���M(j��n)�� ������not null����
ע�������� ��<=>�� �f����NULL-safe equal.�@��(g��)�������͡�=����������(zh��)����ͬ�ı��^���������^�ڃɂ�(g��)�����a����NULL�r(sh��)��������ֵ��1������NULL������(d��ng)һ��(g��)�����a��NULL�r(sh��)��������ֵ��0������NULL��
3��һ������(w��)���؆�������heap�픵(sh��)��(j��)�Gʧ������heap���Y(ji��)��(g��u)��Ȼ���ڣ���?y��n)�heap���Y(ji��)��(g��u)�Ǵ���ڌ�(sh��)�H��(sh��)��(j��)��(k��)·���µ�������(hu��)�Ԅ�(d��ng)�h�����؆�֮����heap����������@�r(sh��)��?q��)�heap�IJ�ԃ�Y(ji��)�����ǿյġ�
4�����heap�Ǐ�(f��)�Ƶ�ij��(sh��)��(j��)�����t��(f��)��֮���������I�������������ȸ�ʽ������(f��)��������Ҫ�����������I�������������Ҫ��Ԓ��
5����(du��)���؆���ɵĔ�(sh��)��(j��)�Gʧ�������µĽ�Q�k����
a�����κβ�ԃ֮ǰ����(zh��)��һ�κ�(ji��n)�εIJ�ԃ���Д�heap���Ƿ���ڔ�(sh��)��(j��)��������������t�є�(sh��)��(j��)������������DROP������(f��)��ij�������@��Ҫ����һ�β�ԃ�����^���Ԍ���include�ļ�������Ҫ��ԓheap�����(y��)���S�r(sh��)�{(di��o)�������^������
b����(du��)����Ҫԓheap�����(y��)������ԓ�(y��)���һ���҃H�ڵ�һ�β�ԃ?c��)���r(sh��)����(du��)��(sh��)��(j��)���Y(ji��)���M(j��n)���Д�������Y(ji��)����գ��t��Ҫ�����딵(sh��)��(j��)���@�ӿ��Թ�(ji��)ʡһ�β�ԃ��
c�����õ��k������mysqlÿ��������(d��ng)�r(sh��)�Ԅ�(d��ng)���딵(sh��)��(j��)��heap��������Ҫ���÷���(w��)�����^�̱��^��(f��)�s��ͨ�����ܵ�������
6��һЩ�A(y��)�ڿ����õ���sql�Z(y��)��
//������������t�h��
DROP TABLE IF EXISTS `abc`;
//��(f��)��������xyz��heap��abc����������(sh��)��(j��)��
CREATE TABLE `abc` type=heap select * from `xyz`;
//�������Iid
ALTER TABLE `abc` ADD PRIMARY KEY (`id`);
//��������username
ALTER TABLE `abc` ADD INDEX `abc` (`username`);
����������
�ٷ��ęn��As indicated by the name, MEMORY tables are stored in memory. They use hash indexes by default, which makes them very fast, and very useful for creating temporary tables. However, when the server shuts down, all rows stored in MEMORY tables are lost. The tables themselves continue to exist because their definitions are stored in .frm files on disk, but they are empty when the server restarts.
���Կ�����MEMORY�_��(sh��)��very fast��and very useful for creating temporary tables .���R�r(sh��)���̓�(n��i)�������һ��ʹ�ô_��(sh��)��(hu��)�첻�٣�create table tmp2(id int not null) engine memory;
��(n��i)����Ľ���߀��һЩ���Ɨl����
MEMORY tables cannot contain BLOB or TEXT columns. HEAP��֧��BLOB/TEXT����
The server needs sufficient memory to maintain all MEMORY tables that are in use at the same time. ��ͬһ�r(sh��)�g��Ҫ���ă�(n��i)��.
To free memory used by a MEMORY table when you no longer require its contents, you should execute DELETE or TRUNCATE TABLE, or remove the table altogether using DROP TABLE.����ጷŃ�(n��i)�����㑪(y��ng)ԓ��(zh��)��DELETE FROM heap_table��DROP TABLE heap_table��
�ׂ�(g��)�P(gu��n)�I����(sh��)
max_heap_table_size
mysql HEAP MEMORY tables ����Д�(sh��)֧�ֵķ���
�e�ˆ����� ӛһ��
mysql MEMORY tables ���Ŀǰ֧�ֵ��Д�(sh��)������߀������ ���� my.conf ��������
max_heap_table_size = 256M
�Ĵ�
�O(sh��)�� MAX_ROWS
������ ���� ALTER TABLE tbl_name MAX_ROWS=
MAX_ROWS ��ه�� max_heap_table_size �O(sh��)��