MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:jon.stephens Date:December 20 2009 12:07pm
Subject:svn commit - mysqldoc@docsrva: r18359 - in trunk: dynamic-docs/changelog refman-5.5 refman-6.0
View as plain text  
Author: jstephens
Date: 2009-12-20 13:07:20 +0100 (Sun, 20 Dec 2009)
New Revision: 18359

Log:

Documented fix for Partitioning Bug #42849

(Now possible to use UNIX_TIMESTAMP(timestamp_col) in partitioning expressions)



Modified:
   trunk/dynamic-docs/changelog/mysqld-1.xml
   trunk/refman-5.5/partitioning.xml
   trunk/refman-6.0/partitioning.xml


Modified: trunk/dynamic-docs/changelog/mysqld-1.xml
===================================================================
--- trunk/dynamic-docs/changelog/mysqld-1.xml	2009-12-20 10:18:26 UTC (rev 18358)
+++ trunk/dynamic-docs/changelog/mysqld-1.xml	2009-12-20 12:07:20 UTC (rev 18359)
Changed blocks: 1, Lines Added: 39, Lines Deleted: 0; 1263 bytes

@@ -6,6 +6,45 @@
 ]>
 <changelog>
 
+  <logentry entrytype="feature">
+
+    <tags>
+      <highlight type="partitioning"/>
+      <manual type="TIMESTAMP"/>
+      <manual type="UNIX_TIMESTAMP()"/>
+    </tags>
+
+    <bugs>
+      <fixes bugid="42849"/>
+    </bugs>
+
+    <versions>
+      <version ver="5.5.1"/>
+      <version ver="6.0.14"/>
+    </versions>
+
+    <message>
+
+      <para>
+        The <literal role="func">UNIX_TIMESTAMP()</literal> function is
+        now supported in partitioning expressions using
+        <literal role="type">TIMESTAMP</literal> columns. For example,
+        it now possible to create a partitioned table such as this one:
+      </para>
+
+<programlisting>
+CREATE TABLE t (c TIMESTAMP) 
+PARTITION BY RANGE ( UNIX_TIMESTAMP(c) ) (
+    PARTITION p0 VALUES LESS THAN (631148400),
+    PARTITION p1 VALUES LESS THAN (946681200),
+    PARTITION p2 VALUES LESS THAN (MAXVALUE)
+);
+</programlisting>
+
+    </message>
+
+  </logentry>
+
   <logentry entrytype="bug">
 
     <tags>


Modified: trunk/refman-5.5/partitioning.xml
===================================================================
--- trunk/refman-5.5/partitioning.xml	2009-12-20 10:18:26 UTC (rev 18358)
+++ trunk/refman-5.5/partitioning.xml	2009-12-20 12:07:20 UTC (rev 18359)
Changed blocks: 2, Lines Added: 34, Lines Deleted: 4; 2543 bytes

@@ -1159,6 +1159,34 @@
     PARTITION p4 VALUES LESS THAN MAXVALUE
 );
 </programlisting>
+
+          <para>
+            Beginning with MySQL 5.5.1, it is also possible to partition
+            a table by <literal>RANGE</literal> based on the value of a
+            <literal role="type">TIMESTAMP</literal> column, using the
+            <literal role="func">UNIX_TIMESTAMP()</literal> function, as
+            shown in this example:
+          </para>
+
+<programlisting>
+CREATE TABLE quarterly_report_status (
+    report_id INT NOT NULL,
+    report_status VARCHAR(20) NOT NULL,
+    report_updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+)
+PARTITION BY RANGE ( UNIX_TIMESTAMP(report_updated) ) (
+    PARTITION p0 VALUES LESS THAN (1199142000),
+    PARTITION p1 VALUES LESS THAN (1207000800),
+    PARTITION p2 VALUES LESS THAN (1214863200),
+    PARTITION p3 VALUES LESS THAN (1222812000),
+    PARTITION p4 VALUES LESS THAN (1230764400),
+    PARTITION p5 VALUES LESS THAN (1238536800),
+    PARTITION p6 VALUES LESS THAN (1246399200),
+    PARTITION p7 VALUES LESS THAN (1254348000),
+    PARTITION p8 VALUES LESS THAN (1262300400),
+    PARTITION p8 VALUES LESS THAN (MAXVALUE)
+);
+</programlisting>
         </listitem>
 
         <listitem>

@@ -6017,14 +6045,16 @@
               <entry><literal role="func">TO_DAYS()</literal></entry>
             </row>
             <row>
+              <entry><literal role="func">TO_SECONDS()</literal> (implemented in MySQL 5.5.0)</entry>
+              <entry><literal role="func">UNIX_TIMESTAMP()</literal> (permitted in MySQL
+                5.5.1 and later, with
+                <literal role="type">TIMESTAMP</literal> columns)</entry>
               <entry><literal role="func">WEEKDAY()</literal></entry>
-              <entry><literal role="func">YEAR()</literal></entry>
-              <entry><literal role="func">YEARWEEK()</literal></entry>
             </row>
             <row>
+              <entry><literal role="func">YEAR()</literal></entry>
               <entry></entry>
-              <entry><literal role="func">TO_SECONDS()</literal> (added in MySQL 5.5.0)</entry>
-              <entry></entry>
+              <entry><literal role="func">YEARWEEK()</literal></entry>
             </row>
           </tbody>
         </tgroup>


Modified: trunk/refman-6.0/partitioning.xml
===================================================================
--- trunk/refman-6.0/partitioning.xml	2009-12-20 10:18:26 UTC (rev 18358)
+++ trunk/refman-6.0/partitioning.xml	2009-12-20 12:07:20 UTC (rev 18359)
Changed blocks: 2, Lines Added: 35, Lines Deleted: 0; 2174 bytes

@@ -991,6 +991,34 @@
       </para>
 
       <para>
+        Beginning with MySQL 6.0.14, it is also possible to partition a
+        table by <literal>RANGE</literal>, based on the value of a
+        <literal role="type">TIMESTAMP</literal> column, using the
+        <literal role="func">UNIX_TIMESTAMP()</literal> function, as
+        shown in this example:
+      </para>
+
+<programlisting>
+CREATE TABLE quarterly_report_status (
+    report_id INT NOT NULL,
+    report_status VARCHAR(20) NOT NULL,
+    report_updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+)
+PARTITION BY RANGE ( UNIX_TIMESTAMP(report_updated) ) (
+    PARTITION p0 VALUES LESS THAN (1199142000),
+    PARTITION p1 VALUES LESS THAN (1207000800),
+    PARTITION p2 VALUES LESS THAN (1214863200),
+    PARTITION p3 VALUES LESS THAN (1222812000),
+    PARTITION p4 VALUES LESS THAN (1230764400),
+    PARTITION p5 VALUES LESS THAN (1238536800),
+    PARTITION p6 VALUES LESS THAN (1246399200),
+    PARTITION p7 VALUES LESS THAN (1254348000),
+    PARTITION p8 VALUES LESS THAN (1262300400),
+    PARTITION p8 VALUES LESS THAN (MAXVALUE)
+);
+</programlisting>
+
+      <para>
         Range partitioning is particularly useful when:
       </para>
 

@@ -5574,9 +5602,16 @@
               <entry><literal role="func">TO_DAYS()</literal></entry>
             </row>
             <row>
+              <entry><literal role="func">UNIX_TIMESTAMP()</literal> (permitted in MySQL
+                6.0.14 and later, with
+                <literal role="type">TIMESTAMP</literal> columns)</entry>
               <entry><literal role="func">WEEKDAY()</literal></entry>
               <entry><literal role="func">YEAR()</literal></entry>
+            </row>
+            <row>
+              <entry></entry>
               <entry><literal role="func">YEARWEEK()</literal></entry>
+              <entry></entry>
             </row>
           </tbody>
         </tgroup>


Thread
svn commit - mysqldoc@docsrva: r18359 - in trunk: dynamic-docs/changelog refman-5.5 refman-6.0jon.stephens20 Dec