myisampackユーティリティはMyISAMテーブルを圧縮します。
myisampackはテーブル内の各カラムを別個に圧縮することで作動します。
通常、myisampackは40%-70%データファイルをパックします。

圧縮後は、読み取り専用テーブルになります。
過去ログをなどに利用すると便利ですね。

[root@colinux DB01]# myisampack -v TABLE100
User time 0.02, System time 0.14
Maximum resident set size 0, Integral resident set size 0
Non-physical pagefaults 380, Physical pagefaults 15, Swaps 0
Blocks in 0 out 0, Messages in 0 out 0, Signals 0
Voluntary context switches 9, Involuntary context switches 3

[root@colinux DB01]# myisamchk -rq --analyze --sort-index TABLE100.MYI
- check record delete-chain
- recovering (with sort) MyISAM-table 'TABLE100.MYI'
Data records: 7
- Fixing index 1
- Fixing index 2
- Sorting index for MyISAM-table 'TABLE100.MYI'

[root@colinux DB01]# mysql -u root -p DB01
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.30-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> FLUSH TABLES;
Query OK, 0 rows affected (0.00 sec)


7.6. myisampack — 圧縮された、読み取り専用MyISAM テーブルを作成する。

[root@colinux DB01]# myisampack -v TABLE101
Compressing TABLE101.MYD: (0 records)
- Calculating statistics

normal: 0 empty-space: 0 empty-zero: 0 empty-fill: 0
pre-space: 0 end-space: 0 intervall-fields: 0 zero: 1
Original trees: 3 After join: 1
- Compressing file
Empty file saved in compressed format
Remember to run myisamchk -rq on compressed tables

User time 0.01, System time 0.03
Maximum resident set size 0, Integral resident set size 0
Non-physical pagefaults 398, Physical pagefaults 0, Swaps 0
Blocks in 0 out 0, Messages in 0 out 0, Signals 0
Voluntary context switches 1, Involuntary context switches 21

[root@colinux DB01]# myisamchk -rq --analyze --sort-index TABLE101.MYI
- check record delete-chain
- recovering (with sort) MyISAM-table 'TABLE101.MYI'
Data records: 0
- Fixing index 1
- Fixing index 2
- Sorting index for MyISAM-table 'TABLE101.MYI'

[root@colinux DB01]# mysql -u root -p -e "SHOW TABLE STATUS LIKE 'TABLE101'" DB01
Enter password:

compressed

Comments are closed.

Post Navigation