Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
ce2329b8
Commit
ce2329b8
authored
Apr 28, 2003
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge pgulutzan@bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/pgulutzan/mysql-4.0
parents
d98d71f5
66dc5ccc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
4 deletions
+69
-4
Docs/internals.texi
Docs/internals.texi
+69
-4
No files found.
Docs/internals.texi
View file @
ce2329b8
...
@@ -2046,12 +2046,15 @@ And if you use Windows, you might find the files in this directory: @*
...
@@ -2046,12 +2046,15 @@ And if you use Windows, you might find the files in this directory: @*
@*@*
@*@*
Let's look at the .MYD Data file (MyISAM SQL Data file) more closely.
Let's look at the .MYD Data file (MyISAM SQL Data file) more closely.
There are three possible formats -- fixed, dynamic, and packed. First,
let's discuss the fixed format.
@table @strong
@table @strong
@item Page Size
@item Page Size
Unlike most DBMSs, MySQL doesn't store on disk using pages. Therefore
Unlike most DBMSs, MySQL doesn't store on disk using pages. Therefore
you will not see filler space between rows. (Reminder: This does not
you will not see filler space between rows. (Reminder: This does not
refer to BDB and I
NNO
DB tables, which do use pages).
refer to BDB and I
nno
DB tables, which do use pages).
@*
@*
@item Record Header
@item Record Header
...
@@ -2069,8 +2072,8 @@ The minimal record header is a set of flags:
...
@@ -2069,8 +2072,8 @@ The minimal record header is a set of flags:
The length of the record header is thus:@*
The length of the record header is thus:@*
(1 + number of NULL columns + 7) / 8 bytes@*
(1 + number of NULL columns + 7) / 8 bytes@*
After the header, all columns are stored in
After the header, all columns are stored in
the order that they were created, which is the
the order that they were created, which is the
same order that you would get from SHOW COLUMNS.
same order that you would get from SHOW COLUMNS.
Here's an example. Suppose you say:
Here's an example. Suppose you say:
...
@@ -2115,10 +2118,72 @@ right is @code{on}, and (b) remember that the first flag bit is the X bit.)
...
@@ -2115,10 +2118,72 @@ right is @code{on}, and (b) remember that the first flag bit is the X bit.)
There are complications -- the record header is more complex if there
There are complications -- the record header is more complex if there
are variable-length fields -- but the simple display shown in the
are variable-length fields -- but the simple display shown in the
example is exactly what you'd see if you looked at the MySQL Data file
example is exactly what you'd see if you looked at the MySQL Data file
with a debugger or a hexadecimal file dumper.
with a debugger or a hexadecimal file dumper.
@*
@*
So much for the fixed format. Now, let's discuss the dynamic format.
@*
The dynamic file format is necessary if rows can vary in size. That will
be the case if there are BLOB columns, or "true" VARCHAR columns. (Remember
that MySQL may treat VARCHAR columns as if they're CHAR columns, in which
case the fixed format is used.) A dynamic row has more fields in the header.
The important ones are "the actual length", "the unused length", and "the
overflow pointer". The actual length is the total number of bytes in all the
columns. The unused length is the total number of bytes between one physical
record and the next one. The overflow pointer is the location of the rest of
the record if there are multiple parts.
@*
For example, here is a dynamic row:@*
@example(
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)
@end example
In the example, the actual length and the unused length
are short (one byte each) because the table definition
says that the columns are short -- if the columns were
potentially large, then the actual length and the unused
length could be two bytes each, three bytes each, and so
on. In this case, actual length plus unused length is 10
hexadecimal (sixteen decimal), which is a minimum.
As for the third format -- packed -- we will only say
briefly that:
@itemize @bullet
@item
Numeric values are stored in a form that depends on the
range (start/end values) for the data type.
@item
All columns are packed using either Huffman or enum coding.
@end itemize
For details, see the source files /myisam/mi
_
statrec.c
(for fixed format), /myisam/mi
_
dynrec.c (for dynamic
format), and /myisam/mi
_
packrec.c (for packed format).
Note: Internally, MySQL uses a format much like the fixed format
which it uses for disk storage. The main differences are:
@enumerate @bullet
@item
BLOBs have a length and a memory pointer rather than being stored inline.
@item
"True VARCHAR" (a column storage which will be fully implemented in
version 5.0) will have a 16-bit length plus the data.
@item
All integer or floating-point numbers are stored with the low byte first.
Point (3) does not apply for ISAM storage or internals.
@end enumerate
@*
@section Physical Attributes of Columns
@section Physical Attributes of Columns
Next I'll describe the physical attributes of each column in a row.
Next I'll describe the physical attributes of each column in a row.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment