ショック

ショックなできごとが急にきた。

でも本人には言いません。
態度にも出しません。
適当なフリします。


本人が読まないことを祈りつつ(何のことやねん)。

mysql - HEAPテーブル

※まだ書きかけです

memcacheの代わりになるかなーって思い、MySQLのHEAPテーブルをちょっと試してみた。

参考URL

MySQL AB :: MySQL 4.1 リファレンスマニュアル :: 7.4 HEAP テーブル - http://dev.mysql.com/doc/refman/4.1/ja/heap.html

実験
 --255より大きいのデータサイズは怒られる
 mysql> create table sample2(
     -> id integer not null,
     -> data varchar(256)) TYPE=HEAP;
 ERROR 1163 (42000): The used table type doesn't support BLOB/TEXT columns
 
 --255以下だと許される
 mysql> create table sample2(
     -> id integer not null,
     -> data varchar(255)) TYPE=HEAP;
 Query OK, 0 rows affected, 1 warning (0.03 sec)
 
 --insertしてみる
 mysql> insert into sample2(id,data) values(1,'aaaaaaaaaaaaaa');
 Query OK, 1 row affected (0.00 sec)
 mysql> select * from sample2;
 +----+----------------+
 | id | data           |
 +----+----------------+
 |  1 | aaaaaaaaaaaaaa |
 +----+----------------+
 1 row in set (0.02 sec)
 
 mysql> quit
 Bye
 
 --ここで、mysql再起動
 
 C:\>mysql -u hoge -p
 Enter password: ********
 Welcome to the MySQL monitor.  Commands end with ; or \g.
 Your MySQL connection id is 6 to server version: 4.1.22-community-nt
 
 Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
 
 mysql> use test
 Database changed
 
 --テーブルの確認
 mysql> show tables;
 +----------------+
 | Tables_in_test |
 +----------------+
 | posts          |
 | sample         |
 | sample2        | -- ←ある
 | session_table  |
 +----------------+
 4 rows in set (0.00 sec)
 
 --メモリがクリアされてるため、データがない
 mysql> select * from sample2;
 Empty set (0.00 sec)