From: Date: November 27 2006 3:14pm Subject: Re: erratum in the "MySQL Internals Manual" List-Archive: http://lists.mysql.com/internals/34138 Message-Id: <20061127141439.GA11906@janus.mylan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Hi! First: I'll forward this reply to our documentation team, they'll fix the manual. On Nov 23, David Lee Lambert wrote: > Section 11.1.1. ("Introduction", > http://dev.mysql.com/doc/internals/en/myisam-introduction.html ) uses the > following example for a MyISAM dynamic row: > > 03, 00 start of header > 04 actual length > 0c unused length > 01, fc flags + overflow pointer > **** data in the row > ************ unused bytes > <-- next row starts here) > > However, the "start of header" is actually only the first byte, 03. That > means that the next two bytes represent the actual length, and the next byte > after that is the unused length. Correct. Though it's "block length", not "unused length" > The notation "flags+overflow pointer" is also confusing. If an overflow > pointer were present (only in blocks of type 05,06,0b,0c, or 0d), it would > come before the flags, as the last 8 bytes of the header. There is no flag > for the overflow byte. I don't see any "flags" at all in the dynamic row header. Overflow pointer is in the last 8 bytes of the header, and only in blocks 05,06,0b,0c,0d, you're right. There's no overflow pointer in the block type 03, that is used in the manual as an example. > Finally, it isn't stated anywhere that there is no "deleted bit" in a dynamic > row. Thus, 8 nullable columns will only take one flag byte, where they > would require 2 bytes in a static table. Deletions are instead marked with a > block of type 0. Right. > One question I still have: does "CREATE TABLE ( ... ) AVG_ROW_LENGTH=xxx" > actually do anything for MyISAM dynamic-row tables under MySQL 5? No matter > what settings I use, the minimum per-row size is 20 bytes, rows are aligned > on 4-byte boundaries, and overflow pointers are 8 bytes long. Not directly. AVG_ROW_LENGTH*MAX_ROWS is used as an estimate for a data file length. Compare create table t1 (a text) max_rows=10000 AVG_ROW_LENGTH=10; create table t2 (a text) max_rows=10000 AVG_ROW_LENGTH=100000; Regards, Sergei -- __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Sergei Golubchik / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior Software Developer /_/ /_/\_, /___/\___\_\___/ Kerpen, Germany <___/ www.mysql.com