Chapter 10 . Databases And Data 235 MySQL
Chapter 10 . Databases And Data 235 MySQL chooses Staticor Dynamictable formats automatically when you create the table. The Compressed table format must be created manually through the use of the myisampack utility. Static format The Static table format is the default and is used when there are no variable- length column types in the table such as VARCHAR or BLOB. If variable-length columns are used, MySQL will choose the Dynamic format for the table. An example of a table definition looks like this as follows: CREATE TABLE example (id int(5) NOT NULL PRIMARY KEY, name char(25), title char(20) ); In the preceding example table, all columns are fixed length as shown by the SHOW TABLE STATUS statement in Figure 10-3. Figure 10-3: The SHOW TABLE STATUS command reveals that the table is in Fixed row format. Static tables have two advantages: . With the exception of volatile-memory table types such as HEAP, the Static table format is the fastest of the three MyISAMoptions because its columns are a uniform size. For example, a CHARcolumn is padded with extra whitespace characters to bring the column up to the defined size; a VARCHARcolumn is not padded with extra characters. Since the column is always the same size, MySQL can sort through the data quicker as it knows that the column is a constant length regardless of the size of the data held within the column. . Padding of fields to the same size makes Static tables safer. The repair utility myisamchk can easily predict the boundaries of columns in a row.
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.