Author: jstephens
Date: 2006-03-10 04:49:32 +0100 (Fri, 10 Mar 2006)
New Revision: 1547
Log:
Reformat.
Modified:
trunk/refman-5.1/partitioning.xml
Modified: trunk/refman-5.1/partitioning.xml
===================================================================
--- trunk/refman-5.1/partitioning.xml 2006-03-10 03:48:22 UTC (rev 1546)
+++ trunk/refman-5.1/partitioning.xml 2006-03-10 03:49:32 UTC (rev 1547)
@@ -1689,7 +1689,7 @@
)
);
</programlisting>
-
+
<para>
(The previous statement is also valid for versions of MySQL
prior to 5.1.8.)
@@ -1899,9 +1899,9 @@
varies between partitioning of different types, and may produce
behavior which you do not expect if you are not prepared for it.
This being the case, we discuss in this section how each MySQL
- partitioning types handles <literal>NULL</literal> values
- when determining the partition in which a row should be stored,
- and provide examples for each.
+ partitioning types handles <literal>NULL</literal> values when
+ determining the partition in which a row should be stored, and
+ provide examples for each.
</para>
<para>
@@ -1958,13 +1958,13 @@
+------+--------+
1 row in set (0.00 sec)
</programlisting>
-
+
<para>
You can see which partitions the rows are stored in by
inspecting the filesystem and comparing the sizes of the
<filename>.MYD</filename> files correpsonding to the partitions:
</para>
-
+
<programlisting>
/var/lib/mysql/test> <userinput>ls -l *.MYD</userinput>
<emphasis role="bold">-rw-rw---- 1 mysql mysql 20 2006-03-10 03:27 t1#P#p0.MYD</emphasis>
@@ -1975,20 +1975,20 @@
-rw-rw---- 1 mysql mysql 0 2006-03-10 03:17 t2#P#p2.MYD
-rw-rw---- 1 mysql mysql 0 2006-03-10 03:17 t2#P#p3.MYD
</programlisting>
-
+
<para>
(Partition files are named according to the format
<literal><replaceable>table_name</replaceable>#P#<replaceable>partition_name</replaceable>.<replaceable>extension</replaceable></literal>,
so that <filename>t1#P#p0.MYD</filename> is the file in which
data belonging to partition <literal>p0</literal> of table
- <literal>t1</literal> is stored.
+ <literal>t1</literal> is stored.
<emphasis role="bold">Note</emphasis>: Prior to MySQL 5.1.5,
these files would have been named <filename>t1_p0.MYD</filename>
and <filename>t2_p0.MYD</filename>, respectively. See
<xref linkend="news-5-1-6"/> and Bug #13437 for information
- regarding how this change impacts upgrades.)
+ regarding how this change impacts upgrades.)
</para>
-
+
<para>
You can also demonstrate that these rows were stored in the
lowest partition of the each table by dropping these partitions,
@@ -2008,15 +2008,16 @@
mysql> <userinput>SELECT * FROM t2;</userinput>
Empty set (0.00 sec)
</programlisting>
-
+
<para>
(For more information on <literal>ALTER TABLE ... DROP
- PARTITION</literal>, see <xref linkend="alter-table"/>.)
+ PARTITION</literal>, see <xref linkend="alter-table"/>.)
</para>
<para>
Such treatment also holds true for partitioning expressions that
- use SQL functions. Suppose that we have a table such as this one:
+ use SQL functions. Suppose that we have a table such as this
+ one:
</para>
<programlisting>
@@ -2035,11 +2036,11 @@
As with other MySQL functions, <literal>YEAR(NULL)</literal>
returns <literal>NULL</literal>. A row with a
<literal>dt</literal> column value of <literal>NULL</literal> is
- treated as though the partitioning expression evaluated to
- a value less than any other value, and so is inserted into
+ treated as though the partitioning expression evaluated to a
+ value less than any other value, and so is inserted into
partition <literal>p0</literal>.
</para>
-
+
<para>
A table that is partitioned by <literal>LIST</literal> admits
<literal>NULL</literal> values if and only if one of its
@@ -2048,9 +2049,9 @@
partitioned by <literal>LIST</literal> which does not explicitly
use <literal>NULL</literal> in a value list rejects rows
resulting in a <literal>NULL</literal> value for the
- partitioning expression, as shown in this example:
+ partitioning expression, as shown in this example:
</para>
-
+
<programlisting>
mysql> <userinput>CREATE TABLE ts1 (</userinput>
-> <userinput>c1 INT,</userinput>
@@ -2069,17 +2070,17 @@
mysql> <userinput>INSERT INTO ts1 VALUES (NULL, 'mothra');</userinput>
<errortext>ERROR 1504 (HY000): Table has no partition for value NULL</errortext>
</programlisting>
-
+
<para>
Only rows having a <literal>c1</literal> value between
<literal>0</literal> and <literal>8</literal> inclusive can be
inserted into <literal>ts1</literal>. <literal>NULL</literal>
falls outside this range, just like the number
- <literal>9</literal>. We can create tables <literal>ts2</literal> and
- <literal>ts3</literal> having value lists containing
- <literal>NULL</literal>, as shown here:
+ <literal>9</literal>. We can create tables
+ <literal>ts2</literal> and <literal>ts3</literal> having value
+ lists containing <literal>NULL</literal>, as shown here:
</para>
-
+
<programlisting>
mysql> CREATE TABLE ts2 (
-> c1 INT,
@@ -2104,19 +2105,19 @@
-> );
Query OK, 0 rows affected (0.01 sec)
</programlisting>
-
+
<para>
When defining value lists for partitioning, you can treat
<literal>NULL</literal> just as you would any other value, and
so <literal>VALUES IN (NULL)</literal> and <literal>VALUES IN
- (1, 4, 7, NULL)</literal> are both valid (as are
- <literal>VALUES IN (1, NULL, 4, 7)</literal>, <literal>VALUES IN
- (NULL, 1, 4, 7)</literal>, and so on). You can insert a
- row having <literal>NULL</literal> for column
- <literal>c1</literal> into each of the tables
- <literal>ts2</literal> and <literal>ts3</literal>:
+ (1, 4, 7, NULL)</literal> are both valid (as are <literal>VALUES
+ IN (1, NULL, 4, 7)</literal>, <literal>VALUES IN (NULL, 1, 4,
+ 7)</literal>, and so on). You can insert a row having
+ <literal>NULL</literal> for column <literal>c1</literal> into
+ each of the tables <literal>ts2</literal> and
+ <literal>ts3</literal>:
</para>
-
+
<programlisting>
mysql> <userinput>INSERT INTO ts2 VALUES (NULL, 'mothra');</userinput>
Query OK, 1 row affected (0.00 sec)
@@ -2124,7 +2125,7 @@
mysql> <userinput>INSERT INTO ts3 VALUES (NULL, 'mothra');</userinput>
Query OK, 1 row affected (0.00 sec)
</programlisting>
-
+
<para>
By inspecting the filesystem, you can verify that the first of
these statements inserted a new row into partition
@@ -2145,7 +2146,7 @@
<emphasis role="bold">-rw-rw---- 1 mysql mysql 20 2006-03-10 10:36 ts3#P#p1.MYD</emphasis>
-rw-rw---- 1 mysql mysql 0 2006-03-10 10:36 ts3#P#p2.MYD
</programlisting>
-
+
<para>
As in earlier examples, we assume the use of the
<command>bash</command> shell on a Unix operating system for
@@ -2154,15 +2155,15 @@
operating system, the equivalent for the last listing might be
obtained by running the command <literal>dir ts3*.MYD</literal>
in the directory <filename>C:\Program Files\MySQL\MySQL Server
- 5.1\data\test</filename>.
+ 5.1\data\test</filename>.
</para>
-
+
<para>
As shown earlier in this section, you can also verify which
partitions were used for storing the values by deleting them and
then performing a <literal>SELECT</literal>.
</para>
-
+
<para>
<literal>NULL</literal> is handled some what differently for
tables partitioned by <literal>HASH</literal> or
@@ -2201,9 +2202,9 @@
<para>
Note that the size of each file is 0 bytes. Now insert a row
- into <literal>th</literal> whose <literal>c1</literal>
- column value is <literal>NULL</literal>, and verify that this row
- was inserted:
+ into <literal>th</literal> whose <literal>c1</literal> column
+ value is <literal>NULL</literal>, and verify that this row was
+ inserted:
</para>
<programlisting>
@@ -2245,17 +2246,17 @@
(increasing its size on disk), without affecting the other data
file.
</para>
-
+
<para>
<emphasis role="bold">Important</emphasis>: Prior to MySQL
5.1.8, <literal>RANGE</literal> partitioning treated a
partitioning expression value of <literal>NULL</literal> as a
zero with respect to determining placement (the only way to
circumvent this was to design tables so as not to allow nulls,
- usually by declaring columns <literal>NOT NULL</literal>). If you
- have a <literal>RANGE</literal> partitioning scheme that depends
- on this earlier behavior, you will need to re-implement it when
- upgrading to MySQL 5.1.8 or later.
+ usually by declaring columns <literal>NOT NULL</literal>). If
+ you have a <literal>RANGE</literal> partitioning scheme that
+ depends on this earlier behavior, you will need to re-implement
+ it when upgrading to MySQL 5.1.8 or later.
</para>
</section>
@@ -3797,7 +3798,7 @@
</para>
<itemizedlist>
-
+
<listitem>
<para>
If, when creating tables with a very large number of
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r1547 - trunk/refman-5.1 | jon | 10 Mar |