Copyright (C) 2000-2012 |
GNU Info (mysql.info)Dynamic formatDynamic Table Characteristics ............................. This format is used if the table contains any `VARCHAR', `BLOB', or `TEXT' columns or if the table was created with `ROW_FORMAT=dynamic'. This format is a little more complex because each row has to have a header that says how long it is. One record can also end up at more than one location when it is made longer at an update. You can use `OPTIMIZE table' or `myisamchk' to defragment a table. If you have static data that you access/change a lot in the same table as some `VARCHAR' or `BLOB' columns, it might be a good idea to move the dynamic columns to other tables just to avoid fragmentation: * All string columns are dynamic (except those with a length less than 4). * Each record is preceded by a bitmap indicating which columns are empty (`''') for string columns, or zero for numeric columns. (This isn't the same as columns containing `NULL' values.) If a string column has a length of zero after removal of trailing spaces, or a numeric column has a value of zero, it is marked in the bit map and not saved to disk. Non-empty strings are saved as a length byte plus the string contents. * Usually takes much less disk space than fixed-length tables. * Each record uses only as much space as is required. If a record becomes larger, it is split into as many pieces as are required. This results in record fragmentation. * If you update a row with information that extends the row length, the row will be fragmented. In this case, you may have to run `myisamchk -r' from time to time to get better performance. Use `myisamchk -ei tbl_name' for some statistics. * Not as easy to reconstruct after a crash, because a record may be fragmented into many pieces and a link (fragment) may be missing. * The expected row length for dynamic sized records is: 3 + (number of columns + 7) / 8 + (number of char columns) + packed size of numeric columns + length of strings + (number of NULL columns + 7) / 8 There is a penalty of 6 bytes for each link. A dynamic record is linked whenever an update causes an enlargement of the record. Each new link will be at least 20 bytes, so the next enlargement will probably go in the same link. If not, there will be another link. You may check how many links there are with `myisamchk -ed'. All links may be removed with `myisamchk -r'. automatically generated by info2www version 1.2.2.9 |