<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>MySQL Forums - Partitioning</title>
        <description>Forum for MySQL Partitioning.</description>
        <link>http://forums.mysql.com/list.php?106</link>
        <lastBuildDate>Sat, 25 May 2013 17:26:50 +0000</lastBuildDate>
        <generator>Phorum 5.2.19</generator>
        <item>
            <guid>http://forums.mysql.com/read.php?106,586187,586187#msg-586187</guid>
            <title>IP vs Date Partition (2 replies)</title>
            <link>http://forums.mysql.com/read.php?106,586187,586187#msg-586187</link>
            <description><![CDATA[ Hey Guys<br />
<br />
I've started to use parititons and am seeing the speed benefits, but I'm unsure if I'm doing it the best way.<br />
<br />
I'm tracking data on the last time an IP took an action. Right now to save space it simply updates the last time field and other data each time they do the action again. I'm then dumping any IPs that have been over 30 days.<br />
<br />
My partition is currently based on IP address. Which has improved the speed in tracking, but I'm not benefiting from faster drop offs over that 30 days. <br />
<br />
I'm hesistent to try partitioning based on date because then it's 30 partitions on each update to find that IP, and if it's been a few days and I update the record to today's date it's gotta move that record which adds more latency.<br />
<br />
So your thoughts? Or am I overestimating how long it takes to check each partition or move data between them?<br />
<br />
Thanks!<br />
<br />
Tim]]></description>
            <dc:creator>Tim Linden</dc:creator>
            <category>Partitioning</category>
            <pubDate>Wed, 15 May 2013 16:06:42 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,584886,584886#msg-584886</guid>
            <title>How should I partition this table? (9 replies)</title>
            <link>http://forums.mysql.com/read.php?106,584886,584886#msg-584886</link>
            <description><![CDATA[ This is my first experience with partitioning as well as managing a db at this level.<br />
<br />
Breif background.  We recently migrated our pervasive db to mysql.  In that process we (I should say others in our dept) partitioned it by hash on the date field.  innodb_file_per_table was not enabled, so all of the tablespace data is in ibdata1.  The table has over 1 billion rows and ibdata1 is 800GB.<br />
<br />
I'm currently in the process of copying the db to a test server to test different partitioning schemes and have enabled innodb_file_per_table.  The structure of the table is as follows.<br />
<br />
INVITMD | CREATE TABLE `INVITMD` (<br />
  `Division` smallint(5) unsigned DEFAULT NULL,<br />
  `InvNum` int(10) unsigned DEFAULT NULL,<br />
  `InvLine` smallint(5) unsigned DEFAULT NULL,<br />
  `PLU` int(10) unsigned DEFAULT NULL,<br />
  `UPC` varchar(14) DEFAULT NULL,<br />
  `Qty` smallint(6) DEFAULT NULL,<br />
  `ItemPrice` double DEFAULT NULL,<br />
  `PriceCode` char(1) DEFAULT NULL,<br />
  `NetPrice` double DEFAULT NULL,<br />
  `DiscountFlag` char(1) DEFAULT NULL,<br />
  `Taxable` char(1) DEFAULT NULL,<br />
  `ComShr` char(1) DEFAULT NULL,<br />
  `QotNum` int(10) unsigned DEFAULT NULL,<br />
  `QotVer` smallint(5) unsigned DEFAULT NULL,<br />
  `QotLine` smallint(5) unsigned DEFAULT NULL,<br />
  `PrimaryAscID` int(10) unsigned DEFAULT NULL,<br />
  `ComSplDate` date DEFAULT NULL,<br />
  `ComSplTime` time DEFAULT NULL,<br />
  `SplitAscID` int(10) unsigned DEFAULT NULL,<br />
  `ItemCost` double DEFAULT NULL,<br />
  `InvDate` date DEFAULT NULL,<br />
  `Expansion` text,<br />
  UNIQUE KEY `Div_date_Line` (`Division`,`InvDate`,`InvNum`,`InvLine`),<br />
  KEY `PluNum` (`Division`,`PLU`),<br />
  KEY `Tax` (`Division`,`Taxable`),<br />
  KEY `UPC` (`Division`,`UPC`),<br />
  KEY `PrimaryAsc` (`Division`,`PrimaryAscID`),<br />
  KEY `SplitAsc` (`Division`,`SplitAscID`),<br />
  KEY `Div_Plu_inv` (`Division`,`PLU`,`InvNum`),<br />
  KEY `Div_Date_Plu` (`Division`,`InvDate`,`PLU`)<br />
) ENGINE=InnoDB DEFAULT CHARSET=utf8<br />
/*!50100 PARTITION BY HASH (YEAR(invdate))<br />
PARTITIONS 10 */<br />
<br />
<br />
My initial plan is to partition by range or list on the Division field giving me between 36 and 40 partitions.  I'm also considering sub partitioning on the InvDate field.  I'd like to do that by range as well, but from my reading subpartitions don't support &quot;by range&quot;.  Is that correct?<br />
<br />
Does my plan sound like the best approach, or can you recommend something better?]]></description>
            <dc:creator>Ron Bergin</dc:creator>
            <category>Partitioning</category>
            <pubDate>Fri, 03 May 2013 15:32:19 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,583148,583148#msg-583148</guid>
            <title>Event add partition works but not the drop partition (1 reply)</title>
            <link>http://forums.mysql.com/read.php?106,583148,583148#msg-583148</link>
            <description><![CDATA[ We have set an event as below. What we notice is that the add partition is working well as we can see on a daily basis the partition list is growing but the drop partition is not work any reason for this? I have checked nothing in the log showing any error regarding to this event.<br />
<br />
<pre class="bbcode">
IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.PARTITIONS 
  WHERE TABLE_NAME = 'testPart1' AND PARTITION_NAME = 
  CONCAT(' p'
    ,   DATE_FORMAT( DATE_SUB( CURDATE(), INTERVAL 14 DAY ), '%Y%m%d' ))) THEN  
    SET @stmt := CONCAT(
        'ALTER TABLE testPart1 DROP PARTITION '
    ,   ' p'
    ,   DATE_FORMAT( DATE_SUB( CURDATE(), INTERVAL 14 DAY ), '%Y%m%d' ) 
    );
    PREPARE stmt FROM @stmt;
    EXECUTE stmt;
    DEALLOCATE PREPARE stmt;  
  END IF; 

  IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.PARTITIONS 
  WHERE TABLE_NAME = 'testPart1' AND PARTITION_NAME = 
  CONCAT(' p'
    ,   DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 2 DAY ), '%Y%m%d' ))) THEN   
  SET @stmt := CONCAT(
        'ALTER TABLE testPart1 ADD PARTITION ('
    ,   'PARTITION p'
    ,   DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 2 DAY ), '%Y%m%d' )
    ,   ' VALUES LESS THAN ('
    ,   TO_DAYS( CURDATE() ) + 2 
    ,   '))'
    );
    PREPARE stmt FROM @stmt;
    EXECUTE stmt;
    DEALLOCATE PREPARE stmt; 
  END IF; 
</pre>]]></description>
            <dc:creator>Frwa Onto</dc:creator>
            <category>Partitioning</category>
            <pubDate>Fri, 05 Apr 2013 10:13:57 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,582366,582366#msg-582366</guid>
            <title>Performance doubt (1 reply)</title>
            <link>http://forums.mysql.com/read.php?106,582366,582366#msg-582366</link>
            <description><![CDATA[ Hello,<br />
<br />
I'm developing an app where we'll have a lot of data and I think data partition will help to make the queries run faster. But we are not sure what type of partition to use.<br />
We want to part our table by a year-month basis, because the queries will always query data within the same month of a given year.<br />
<br />
To ease the process, we are going to create an int field named &quot;yearmonth&quot; and create an index and the partition with it. The field values will be the year and month concatenated yyyymm; for example, for the date 18/01/2013 the value will be 201301.<br />
<br />
We want to have a partition for every month, and we are not sure what's best.<br />
<br />
OPTION 1: Range partition<br />
<br />
PARTITION BY RANGE ( yearmonth ) (<br />
    PARTITION p0 VALUES LESS THAN (201301),<br />
    PARTITION p1 VALUES LESS THAN (201302),<br />
    PARTITION p2 VALUES LESS THAN (201303),<br />
    ...<br />
    PARTITION pN VALUES LESS THAN MAXVALUE<br />
);<br />
<br />
Pros: We have the exact partition number we need.<br />
Cons: We'll have to add a new partition set every time we approach the last yearmonth.<br />
<br />
OPTION 2: Key partition<br />
<br />
PARTITION BY KEY( yearmonth )<br />
PARTITIONS 1024;<br />
<br />
Pros: No need of any maintenance for the next 85 years.<br />
Cons: Lots of empty partitions.<br />
<br />
Note: 1024 it's an limit case, we can use something like 120 to store 10 years of data.<br />
<br />
<br />
Our doubt is wether to use key or range partition, mainly because of the &quot;unused&quot; partitions. Will this extra partitions slow down the queries of affect any other processes? Just FYI, we know that we will have to use the yearmonth field as the first WHERE condition in order to select the right partition number but again, still not know if the empty partitions can affect us in a wrong way.<br />
<br />
Many thanks in advance,<br />
<br />
Xavier Borrut]]></description>
            <dc:creator>Xavier Borrut</dc:creator>
            <category>Partitioning</category>
            <pubDate>Thu, 28 Mar 2013 06:34:14 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,581865,581865#msg-581865</guid>
            <title>Should I partition? (3 replies)</title>
            <link>http://forums.mysql.com/read.php?106,581865,581865#msg-581865</link>
            <description><![CDATA[ I'm looking to have a database that processes 20G worth of CDRs per day, with a revolving window of a month. I was thinking about setting up partitioning based on day, and then compressing each partition after that day passes in order to speed up searching and limit the amount of physical storage is required. Before the day comes back to current, I'd truncate the table.<br />
<br />
From what I can find, compressing partitions isn't an option.<br />
<br />
I then thought about doing an Archive storage type, but that sounds like it will help with storage space but can (greatly) increase SELECT times due to the lack of indexing.<br />
<br />
At this point, I'm wondering if I'm going to have to do something more non-standard in order to insert into separate tables, compress those tables when I'm done inserting, then write a front-end that would select from multiple tables (if needed). Then more junk to handle truncation.<br />
<br />
Any suggestions (from a generic level) to manage this kind of task? Can you compress a single partition out of a set (and I'm just not finding the documentation)?<br />
<br />
Edit: I should add that the biggest limitation I have right now is drive space (call it lack of funding for a pet project).]]></description>
            <dc:creator>Jacob Steinberger</dc:creator>
            <category>Partitioning</category>
            <pubDate>Fri, 05 Apr 2013 05:35:29 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,580670,580670#msg-580670</guid>
            <title>Partitioned table problem after upgrade to 5.5 (4 replies)</title>
            <link>http://forums.mysql.com/read.php?106,580670,580670#msg-580670</link>
            <description><![CDATA[ hi All<br />
i have a hash partitioned table in MySQL 5.1.<br />
and there is a compound unique index on this table.<br />
i stop mysql 5.1 service and copy all the data to the mysql 5.5 server.<br />
and all other tables are working well except this partitioned table.<br />
i try to use a string to query the record in this partitioned table, it returns to me no record. The string column is one of the unique index column.<br />
but definately there is a record there because i can query from the ID.<br />
anyone met this problem?<br />
and anyone know how to solve this?<br />
thanks.<br />
Jack]]></description>
            <dc:creator>Ming Wang</dc:creator>
            <category>Partitioning</category>
            <pubDate>Fri, 08 Mar 2013 08:20:17 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,579929,579929#msg-579929</guid>
            <title>If you use a partition table in mysql5.5, Contact function (1 reply)</title>
            <link>http://forums.mysql.com/read.php?106,579929,579929#msg-579929</link>
            <description><![CDATA[ I have been using mysql5.5. I'm trying to use the partition table.<br />
Out with this partition function is not allowed to try to use the syntax PARTITION BY LIST (i% s')) DAYOFYEAR (STR_TO_DATE (logintime, &quot;% Y% m% d% H%).<br />
I think it is what you need to check?<br />
Thank you.]]></description>
            <dc:creator>kyung gi lee</dc:creator>
            <category>Partitioning</category>
            <pubDate>Thu, 28 Feb 2013 15:34:50 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,579141,579141#msg-579141</guid>
            <title>How to (temporary) disable one partition in the partitioned table (2 replies)</title>
            <link>http://forums.mysql.com/read.php?106,579141,579141#msg-579141</link>
            <description><![CDATA[ Dear MySQL Guru,<br />
Is it possible to disable ('turn off') one partition in the partitioned table (just like it is possible with Oracle)? How can I do this? (and how to 'turn it on' after that).<br />
<br />
That is wanted to simulate fail of a part of the system.]]></description>
            <dc:creator>First Bell</dc:creator>
            <category>Partitioning</category>
            <pubDate>Thu, 28 Feb 2013 11:51:03 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,578724,578724#msg-578724</guid>
            <title>FREE!  MySQL Health Check (no replies)</title>
            <link>http://forums.mysql.com/read.php?106,578724,578724#msg-578724</link>
            <description><![CDATA[ FREE!  MySQL Health Check<br />
<a href="https://www.mysql.com/news-and-events/health-check/"  rel="nofollow">https://www.mysql.com/news-and-events/health-check/</a>]]></description>
            <dc:creator>Edwin Desouza</dc:creator>
            <category>Partitioning</category>
            <pubDate>Fri, 08 Feb 2013 04:18:44 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,578458,578458#msg-578458</guid>
            <title>MySQL Partitioning showing low performance (2 replies)</title>
            <link>http://forums.mysql.com/read.php?106,578458,578458#msg-578458</link>
            <description><![CDATA[ I was trying to check whether implementing MySQL database partitioning is beneficial for our application or not. I have heard a lot about the benefits of using partitioning for large number of records. <br />
But surprisingly, the response time of the application got reduced by 3 times when doing the load testing after partitioning was implemented. Could someone please help with the reason why this may happen? <br />
<br />
Let me explain in detail: <br />
<br />
Below is the DDL of the table when partitioning was ‘not’ in place. <br />
<br />
CREATE TABLE `myTable` ( <br />
`column1` bigint(20) unsigned NOT NULL AUTO_INCREMENT, <br />
`column2` char(3) NOT NULL, <br />
`column3` char(3) NOT NULL, <br />
`column4` char(2) NOT NULL, <br />
`column5` smallint(4) unsigned NOT NULL, <br />
`column6` date NOT NULL, <br />
`column7` varchar(2) NOT NULL, <br />
`column8` tinyint(3) unsigned NOT NULL COMMENT 'Seat Count Ranges from 0-9.', <br />
`column9` varchar(2) NOT NULL, <br />
`column10` varchar(4) NOT NULL, <br />
`column11` char(2) NOT NULL, <br />
`column12` datetime NOT NULL, <br />
`column13` datetime DEFAULT NULL, <br />
PRIMARY KEY (`column1`), <br />
KEY `index1` (`column2`,`column3`,`column4`,`column5`,`column7`,`column6`), <br />
KEY `index2` (`column2`,`column3`,`column6`,`column4`) <br />
) ENGINE=InnoDB AUTO_INCREMENT=342024674 DEFAULT CHARSET=latin1; <br />
<br />
And below is the DDL of the same table after implementing ‘Range’ partitioning based on a date field. <br />
<br />
CREATE TABLE `myTable` ( <br />
`column1` bigint(20) unsigned NOT NULL AUTO_INCREMENT, <br />
`column2` char(3) NOT NULL, <br />
`column3` char(3) NOT NULL, <br />
`column4` char(2) NOT NULL, <br />
`column5` smallint(4) unsigned NOT NULL, <br />
`column6` date NOT NULL, <br />
`column7` varchar(2) NOT NULL, <br />
`column8` tinyint(3) unsigned NOT NULL COMMENT 'Seat Count Ranges from 0-9.', <br />
`column9` varchar(2) NOT NULL, <br />
`column10` varchar(4) NOT NULL, <br />
`column11` char(2) NOT NULL, <br />
`column12` datetime NOT NULL, <br />
`column13` datetime DEFAULT NULL, <br />
PRIMARY KEY (`column1`,`column6`), <br />
KEY `index1` (`column2`,`column3`,`column4`,`column5`,`column7`,`column6`), <br />
KEY `index2` (`column2`,`column3`,`column6`,`column4`) <br />
) ENGINE=InnoDB AUTO_INCREMENT=342024674 DEFAULT CHARSET=latin1 <br />
PARTITION BY RANGE COLUMNS(`column6`) <br />
(PARTITION date_jul_11 VALUES LESS THAN ('2011-08-01') ENGINE = InnoDB, <br />
PARTITION date_aug_11 VALUES LESS THAN ('2011-09-01') ENGINE = InnoDB, <br />
PARTITION date_sep_11 VALUES LESS THAN ('2011-10-01') ENGINE = InnoDB, <br />
PARTITION date_oct_11 VALUES LESS THAN ('2011-11-01') ENGINE = InnoDB, <br />
PARTITION date_nov_11 VALUES LESS THAN ('2011-12-01') ENGINE = InnoDB, <br />
PARTITION date_dec_11 VALUES LESS THAN ('2012-01-01') ENGINE = InnoDB, <br />
PARTITION date_jan_12 VALUES LESS THAN ('2012-02-01') ENGINE = InnoDB, <br />
PARTITION date_feb_12 VALUES LESS THAN ('2012-03-01') ENGINE = InnoDB, <br />
PARTITION date_mar_12 VALUES LESS THAN ('2012-04-01') ENGINE = InnoDB, <br />
PARTITION date_apr_12 VALUES LESS THAN ('2012-05-01') ENGINE = InnoDB, <br />
PARTITION date_may_12 VALUES LESS THAN ('2012-06-01') ENGINE = InnoDB, <br />
PARTITION date_jun_12 VALUES LESS THAN ('2012-07-01') ENGINE = InnoDB, <br />
PARTITION date_jul_12 VALUES LESS THAN ('2012-08-01') ENGINE = InnoDB, <br />
PARTITION date_aug_12 VALUES LESS THAN ('2012-09-01') ENGINE = InnoDB, <br />
PARTITION date_sep_12 VALUES LESS THAN ('2012-10-01') ENGINE = InnoDB, <br />
PARTITION date_oct_12 VALUES LESS THAN ('2012-11-01') ENGINE = InnoDB, <br />
PARTITION date_nov_12 VALUES LESS THAN ('2012-12-01') ENGINE = InnoDB, <br />
PARTITION date_dec_12 VALUES LESS THAN ('2013-01-01') ENGINE = InnoDB, <br />
PARTITION date_jan_13 VALUES LESS THAN ('2013-02-01') ENGINE = InnoDB, <br />
PARTITION date_feb_13 VALUES LESS THAN ('2013-03-01') ENGINE = InnoDB, <br />
PARTITION date_mar_13 VALUES LESS THAN ('2013-04-01') ENGINE = InnoDB, <br />
PARTITION date_apr_13 VALUES LESS THAN ('2013-05-01') ENGINE = InnoDB, <br />
PARTITION date_may_13 VALUES LESS THAN ('2013-06-01') ENGINE = InnoDB, <br />
PARTITION date_jun_13 VALUES LESS THAN ('2013-07-01') ENGINE = InnoDB, <br />
PARTITION date_oth VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB); <br />
<br />
Below is a sample query which was used for doing the load testing to test the performance. <br />
<br />
SELECT column8, column9 FROM myTable WHERE column2 = ? AND column3 = ? AND column4 =? AND column5 = ? AND column7 = ? AND column6 = ? LIMIT 1; <br />
<br />
The ‘?’ above were replaced with real values present in the database for testing. <br />
<br />
Please note that the number of records in ‘myTable’ table is around 342 million, and the number of test data used for doing the performance testing is about 2 million. <br />
<br />
However, as I said, the performance after implementing partitioning was reduced by a shocking 3 times. Any idea what may have caused this? <br />
<br />
Also, please let me know if doing any further change in the table structure or indexing may help resolve this issue.]]></description>
            <dc:creator>Manosh Manohar</dc:creator>
            <category>Partitioning</category>
            <pubDate>Fri, 08 Feb 2013 06:39:19 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,578182,578182#msg-578182</guid>
            <title>Index with partitioning (6 replies)</title>
            <link>http://forums.mysql.com/read.php?106,578182,578182#msg-578182</link>
            <description><![CDATA[ Hi,<br />
<br />
I have mysql 5.5.15 version and I am using partitioning successfully. I have a 15 million records table by now.<br />
<br />
There is a small performance issue on index enable after table load though.<br />
It is a data warehouse project, and before loading records on the fact table, I disable the index for better insert performance. After inserting, I enable the index again, but this process of enabling index takes 5 minutes, I know it´s not that bad but I am concerned about that.<br />
<br />
Am I doing this right? Is there any thing I should do to get more performance?]]></description>
            <dc:creator>Hélio Hélio</dc:creator>
            <category>Partitioning</category>
            <pubDate>Thu, 14 Feb 2013 18:26:18 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,577103,577103#msg-577103</guid>
            <title>How to let the query run on one partition (1 reply)</title>
            <link>http://forums.mysql.com/read.php?106,577103,577103#msg-577103</link>
            <description><![CDATA[ Hello,<br />
<br />
I am using NDBCluster 7.1 and try to enhance system performance as high as possible.<br />
<br />
I have one table TA as below,<br />
<br />
create table TA(<br />
  USER_ALIAS varchar(100),<br />
  USER_ID varchar(100),<br />
  NAME varchar(50),<br />
  primary(USER_ALIAS)<br />
) ENGINE=NDB;<br />
<br />
USER_ALIAS and USER_ID is N:1, that is many USER_ALIAS maping to one USER_ID, e.g.<br />
 HAPPY-Boy --&gt; 101010<br />
 North-Boy --&gt; 101010<br />
 Locky-Boy --&gt; 101010<br />
<br />
The query ' select * from TA where USER_ID='101010' ' will run on all partitions, as the table is partitioned by USER_ALIAS which is the primary key.<br />
<br />
What I want to do is to partition the table by USER_ID, so I do it as below,<br />
create table TA(<br />
  USER_ALIAS varchar(100),<br />
  USER_ID varchar(100),<br />
  NAME varchar(50),<br />
  primary key (USER_ALIAS, USER_ID)<br />
) ENGINE=NDB<br />
partition by key(USER_ID);<br />
<br />
then the query like <br />
- select * from TA where USER_ID='101010'<br />
- select * from TA where USER_ALIAS='HAPPY-Boy'<br />
can run on just one partition.<br />
<br />
However, MYSQL won't do that. To the query 'select * from TA where USER_ALIAS='HAPPY-Boy' would run on all partitions.<br />
<br />
So, how can i do?<br />
<br />
Thanks.<br />
<br />
Alax]]></description>
            <dc:creator>Alax James</dc:creator>
            <category>Partitioning</category>
            <pubDate>Fri, 11 Jan 2013 02:45:00 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,576343,576343#msg-576343</guid>
            <title>How to partition by City \ State (1 reply)</title>
            <link>http://forums.mysql.com/read.php?106,576343,576343#msg-576343</link>
            <description><![CDATA[ I have a table with ~20M rows and every query against it will include state or city or a combination so I was thinking of partitioning the table using a combo of the two fields like so:<br />
<br />
ALTER TABLE `test`.`test`<br />
PARTITION BY RANGE COLUMNS (city, state) (<br />
    PARTITION p0 VALUES LESS THAN ('a','AE'),<br />
    PARTITION p1 VALUES LESS THAN ('c','AE'),<br />
    PARTITION p2 VALUES LESS THAN ('e','AE'),<br />
    PARTITION p3 VALUES LESS THAN ('g','AE'),<br />
    PARTITION p4 VALUES LESS THAN ('i','AE'),<br />
    PARTITION p5 VALUES LESS THAN ('k','AE'),<br />
    PARTITION p6 VALUES LESS THAN ('m','AE'),<br />
    PARTITION p7 VALUES LESS THAN ('o','AE'),<br />
    PARTITION p8 VALUES LESS THAN ('q','AE'),<br />
    PARTITION p9 VALUES LESS THAN ('s','AE'),<br />
    PARTITION p10 VALUES LESS THAN ('u','AE'),<br />
    PARTITION p11 VALUES LESS THAN ('w','AE'),<br />
    PARTITION p12 VALUES LESS THAN ('y','AE'),<br />
    PARTITION p13 VALUES LESS THAN ('a','AK'),<br />
    PARTITION p14 VALUES LESS THAN ('c','AK'),<br />
    PARTITION p15 VALUES LESS THAN ('e','AK'),<br />
    PARTITION p16 VALUES LESS THAN ('g','AK'),<br />
    PARTITION p17 VALUES LESS THAN ('i','AK'),<br />
    PARTITION p18 VALUES LESS THAN ('k','AK'),<br />
    PARTITION p19 VALUES LESS THAN ('m','AK'),<br />
    PARTITION p20 VALUES LESS THAN ('o','AK'),<br />
    PARTITION p21 VALUES LESS THAN ('q','AK'),<br />
    PARTITION p22 VALUES LESS THAN ('s','AK'),<br />
    PARTITION p23 VALUES LESS THAN ('u','AK'),<br />
    PARTITION p24 VALUES LESS THAN ('w','AK'),<br />
    PARTITION p25 VALUES LESS THAN ('y','AK'),<br />
    PARTITION p26 VALUES LESS THAN ('a','AL'),<br />
    PARTITION p27 VALUES LESS THAN ('c','AL'),<br />
    PARTITION p28 VALUES LESS THAN ('e','AL'),<br />
    PARTITION p29 VALUES LESS THAN ('g','AL'),<br />
    PARTITION p30 VALUES LESS THAN ('i','AL'),<br />
    PARTITION p31 VALUES LESS THAN ('k','AL'),<br />
    PARTITION p32 VALUES LESS THAN ('m','AL'),<br />
    PARTITION p33 VALUES LESS THAN ('o','AL'),<br />
    PARTITION p34 VALUES LESS THAN ('q','AL'),<br />
    PARTITION p35 VALUES LESS THAN ('s','AL'),<br />
    PARTITION p36 VALUES LESS THAN ('u','AL'),<br />
    PARTITION p37 VALUES LESS THAN ('w','AL'),<br />
    PARTITION p38 VALUES LESS THAN ('y','AL'),<br />
    PARTITION p39 VALUES LESS THAN ('a','AR'),<br />
    PARTITION p40 VALUES LESS THAN ('c','AR'),<br />
    PARTITION p41 VALUES LESS THAN ('e','AR'),<br />
    PARTITION p42 VALUES LESS THAN ('g','AR'),<br />
    PARTITION p43 VALUES LESS THAN ('i','AR'),<br />
    PARTITION p44 VALUES LESS THAN ('k','AR'),<br />
    PARTITION p45 VALUES LESS THAN ('m','AR'),<br />
    PARTITION p46 VALUES LESS THAN ('o','AR'),<br />
    PARTITION p47 VALUES LESS THAN ('q','AR'),<br />
    PARTITION p48 VALUES LESS THAN ('s','AR'),<br />
    PARTITION p49 VALUES LESS THAN ('u','AR'),<br />
    PARTITION p50 VALUES LESS THAN ('w','AR').....<br />
<br />
However, this fails to work with this error:<br />
<br />
ERROR 1493 (HY000): VALUES LESS THAN value must be strictly increasing for each partition<br />
<br />
What would be a valid solution for partitioning this table?]]></description>
            <dc:creator>Noah Goodrich</dc:creator>
            <category>Partitioning</category>
            <pubDate>Fri, 21 Dec 2012 04:00:39 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,575696,575696#msg-575696</guid>
            <title>Partition behaiour seems abnormal in range partition (1 reply)</title>
            <link>http://forums.mysql.com/read.php?106,575696,575696#msg-575696</link>
            <description><![CDATA[ I have created a table using mysql partition using range and have inserted millions of data. <br />
<br />
<br />
<br />
    CREATE TABLE `PART_SAMPLE ` (<br />
      `TRANSACTION_ID` bigint(25) NOT NULL AUTO_INCREMENT,<br />
      `TASK_ID` int(11) DEFAULT NULL,<br />
      `STATUS_CODE` int(10) DEFAULT NULL,<br />
      `FIELD10` int(5) DEFAULT NULL,<br />
      KEY `TXN_ID` (`TRANSACTION_ID`),<br />
      KEY `TASK_IDX` (`TASK_ID`),<br />
      KEY `id_idx_task_status` (`TASK_ID`,`STATUS_CODE`),<br />
      KEY `IDX_STATUS` (`STATUS_CODE`),<br />
      KEY `Fld_idx` (`FIELD10`)<br />
    ) ENGINE=MyISAM AUTO_INCREMENT=12249932 DEFAULT CHARSET=latin1<br />
    /*!50100 PARTITION BY RANGE (FIELD10)<br />
    (PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM,<br />
     PARTITION p1 VALUES LESS THAN (1) ENGINE = MyISAM,<br />
     PARTITION p2 VALUES LESS THAN (2) ENGINE = MyISAM,<br />
     PARTITION p3 VALUES LESS THAN (3) ENGINE = MyISAM,<br />
     PARTITION p4 VALUES LESS THAN (4) ENGINE = MyISAM,<br />
     PARTITION p5 VALUES LESS THAN (5) ENGINE = MyISAM,<br />
     PARTITION p6 VALUES LESS THAN (6) ENGINE = MyISAM,<br />
     PARTITION p7 VALUES LESS THAN (7) ENGINE = MyISAM,<br />
     PARTITION p8 VALUES LESS THAN (8) ENGINE = MyISAM,<br />
     PARTITION p9 VALUES LESS THAN (9) ENGINE = MyISAM,<br />
     PARTITION p10 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */<br />
<br />
**Each Field10(0-10) value is having 3 million data each. But when am executing a select query as this** <br />
<br />
<br />
    select TASK_ID,STATUS_CODE,count(*) from PART_SAMPLE where FIELD10=X group by TASK_ID,STATUS_CODE;<br />
<br />
x can be any value in the partition<br />
<br />
for x value 0,2,5,8 it is taking only 10 seconds to retrive result but for rest it is taking abount 50s to rerive the result.  As per my understating since data is same for all Fields almost same time has to be taken for any Field10 value. Why this time difference is coming. Is it because the way i have used partitioning is wrong or some thing else?]]></description>
            <dc:creator>Rahul K K</dc:creator>
            <category>Partitioning</category>
            <pubDate>Thu, 20 Dec 2012 20:56:13 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,574196,574196#msg-574196</guid>
            <title>partition by range on decimal type (5 replies)</title>
            <link>http://forums.mysql.com/read.php?106,574196,574196#msg-574196</link>
            <description><![CDATA[ hi experts,<br />
<br />
I need your help in getting my partitioning working.<br />
I have a problem with paritioning on DECIMAL column (in fact this should be DATE but I have no chance to change it).<br />
So I use floor() to return integer. Column 'starttime' used in partitioning is used in primary key, so the requirement is met.<br />
<br />
this is my code:<br />
===============<br />
<br />
mysql&gt; desc bts_hour;<br />
+-----------------------------------------------+---------------+------+-----+---------+-------+<br />
| Field                                         | Type          | Null | Key | Default | Extra |<br />
+-----------------------------------------------+---------------+------+-----+---------+-------+<br />
| bts_gid                                       | decimal(20,0) | NO   | PRI | NULL    |       |<br />
| starttime                                     | decimal(14,0) | NO   | PRI | NULL    |       |        &lt;-------- this is it<br />
| bsc_gid                                       | decimal(20,0) | NO   |     | NULL    |       |<br />
| BSC_NAME                                      | varchar(80)   | YES  |     | NULL    |       |<br />
| BTS_NAME                                      | varchar(80)   | YES  | MUL | NULL    |       |<br />
...<br />
<br />
#added index<br />
 alter table test.bts_hour <br />
 add PRIMARY KEY (`bts_gid`,`starttime`),<br />
 add KEY `starttime` (`starttime`),<br />
 add KEY `bts_gid` (`bts_gid`),<br />
 add KEY `bts_name` (`BTS_NAME`);<br />
<br />
 select count(*) from test.bts_hour;<br />
+----------+<br />
| count(*) |<br />
+----------+<br />
|  1000000 |<br />
+----------+<br />
<br />
 select min(starttime), max(starttime) from test.bts_hour;<br />
+----------------+----------------+<br />
| min(starttime) | max(starttime) |<br />
+----------------+----------------+<br />
|     2011033000 |     2011063018 |<br />
+----------------+----------------+<br />
<br />
# add partitiong<br />
alter table test.bts_hour<br />
partition by RANGE (floor(starttime)) (<br />
partition p00 values less than (2011040100),<br />
partition p01 values less than (2011050100),<br />
partition p02 values less than (MAXVALUE)<br />
);<br />
<br />
#check ditribution of data among partitions<br />
select partition_name part, partition_expression expr, partition_description val, partition_method meth, table_rows<br />
  from information_schema.partitions<br />
where table_name = 'bts_hour'<br />
  and TABLE_SCHEMA = 'test';<br />
<br />
+------+------------------+------------+-------+------------+<br />
| part | expr             | val        | meth  | table_rows |<br />
+------+------------------+------------+-------+------------+<br />
| p00  | floor(starttime) | 2011040100 | RANGE |      20352 |<br />
| p01  | floor(starttime) | 2011050100 | RANGE |     297084 |<br />
| p02  | floor(starttime) | MAXVALUE   | RANGE |     682564 |<br />
+------+------------------+------------+-------+------------+<br />
<br />
===================<br />
<br />
now, when I run 'explain', all the partitions are used instead of p01 that has the set of values I want!<br />
<br />
explain partitions<br />
SELECT bts_name, str_to_date(convert(STARTTIME, CHAR(10)), '%Y%m%d%H') as Date<br />
  FROM test.bts_hour<br />
WHERE STARTTIME between 2011040200 and 2011040523<br />
ORDER BY bts_name, starttime<br />
\G<br />
<br />
*************************** 1. row ***************************<br />
           id: 1<br />
  select_type: SIMPLE<br />
        table: bts_hour<br />
   partitions: p00,p01,p02       &lt;--------- here it is, instead of p01 only<br />
         type: range<br />
possible_keys: starttime,starttime_bts_gid,starttime_bts_name<br />
          key: starttime_bts_name<br />
      key_len: 7<br />
          ref: NULL<br />
         rows: 26021<br />
        Extra: Using where; Using index; Using filesort<br />
1 row in set (0.00 sec)<br />
<br />
<br />
What's wrong with this approach?]]></description>
            <dc:creator>Greg K.</dc:creator>
            <category>Partitioning</category>
            <pubDate>Sat, 24 Nov 2012 03:03:55 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,574158,574158#msg-574158</guid>
            <title>Fortnight partitions (4 replies)</title>
            <link>http://forums.mysql.com/read.php?106,574158,574158#msg-574158</link>
            <description><![CDATA[ Hi,<br />
<br />
In our application we need to store users info with attributes like name,description,location etc. along with friends count and user message count.<br />
We want to maintain the history of the friends count and messages count for a given user per fortnight. We would need upto around 6 months data(about 12 fortnights) of friends count and message count. Data older than 6 months should be deleted/truncated. Would partitioning be a good solution for this and if so what kind of partitioning on what column(s) would be useful?<br />
<br />
Table definition is:<br />
<br />
CREATE TABLE `user_data` (  <br />
`userID` int(10) unsigned NOT NULL, <br />
`userName` varchar(45) DEFAULT NULL, <br />
`location` varchar(60) DEFAULT NULL, <br />
`friends_cnt` int(10) unsigned NOT NULL, <br />
`messages_cnt` int(10) unsigned NOT NULL, <br />
`geo_code` int(10) unsigned DEFAULT NULL, <br />
`lastupd` bigint(20) unsigned DEFAULT '0', <br />
PRIMARY KEY (`userID`),  <br />
  KEY `userName_idx` (`userName`) USING BTREE,<br />
  KEY `geo_idx` (`geo_code`) USING BTREE<br />
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 <br />
<br />
<br />
-------------------------------------------------- <br />
2. InnoDB specific variables: <br />
-------------------------------------------------- <br />
have_innodb	YES <br />
ignore_builtin_innodb	OFF <br />
innodb_adaptive_hash_index	ON <br />
innodb_additional_mem_pool_size	1048576 <br />
innodb_autoextend_increment	8 <br />
innodb_autoinc_lock_mode	1 <br />
innodb_buffer_pool_size	1073741824 <br />
innodb_checksums	ON <br />
innodb_commit_concurrency	0 <br />
innodb_concurrency_tickets	500 <br />
innodb_data_file_path	ibdata1:10M:autoextend <br />
innodb_data_home_dir	<br />
innodb_doublewrite	ON <br />
innodb_fast_shutdown	1 <br />
innodb_file_io_threads	4 <br />
innodb_file_per_table	OFF <br />
innodb_flush_log_at_trx_commit	0 <br />
innodb_flush_method	<br />
innodb_force_recovery	0 <br />
innodb_lock_wait_timeout	50 <br />
innodb_locks_unsafe_for_binlog	OFF <br />
innodb_log_buffer_size	1048576 <br />
innodb_log_file_size	50485760 <br />
innodb_log_files_in_group	2 <br />
innodb_log_group_home_dir	./ <br />
innodb_max_dirty_pages_pct	90 <br />
innodb_max_purge_lag	0 <br />
innodb_mirrored_log_groups	1 <br />
innodb_open_files	300 <br />
innodb_rollback_on_timeout	OFF <br />
innodb_stats_method	nulls_equal <br />
innodb_stats_on_metadata	ON <br />
innodb_support_xa	ON <br />
innodb_sync_spin_loops	20 <br />
innodb_table_locks	ON <br />
innodb_thread_concurrency	8 <br />
innodb_thread_sleep_delay	10000 <br />
innodb_use_legacy_cardinality_algorithm	ON <br />
-------------------------------------------------------- <br />
<br />
3. my.cnf content : <br />
--------------------------------------------------------- <br />
[mysqld] <br />
#symbolic-links=0 <br />
key_buffer_size=33554432 <br />
innodb_buffer_pool_size=1G <br />
innodb_log_file_size=50485760 <br />
innodb_flush_log_at_trx_commit=0 <br />
tmp_table_size=100M <br />
max_heap_table_size=70M <br />
max_allowed_packet=32M <br />
max_connections=400 <br />
#open_files_limit=8192 <br />
#table_cache=256 <br />
#innodb_file_per_table=ON <br />
<br />
The SELECTS are straightforward where only the indexed columns are used in the where clause. <br />
<br />
select * from user_data where user_name in(&lt;uname1&gt;,&lt;uname2&gt;...); <br />
select * from user_data where userID =&lt;userid&gt;; <br />
<br />
The table does not have any foreign key relationships and no joins are needed too for our SELECT queries.Above are the only indexes/keys. We have high freq updates/inserts into the above table around 2500 per minute. <br />
<br />
We are using batch INSERTs of 1000 and we can't use LOAD DATA as we are using INSERT ... ON DUPLICATE KEY and LOAD DATA does not have similar ON DUPLICATE KEY functionality. <br />
<br />
There is no replication involved and we do have couple of INSERT/UPDATE triggers.]]></description>
            <dc:creator>Srikanth Mamidi</dc:creator>
            <category>Partitioning</category>
            <pubDate>Fri, 23 Nov 2012 06:04:30 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,573576,573576#msg-573576</guid>
            <title>milliseconds in mysql equivalent to java for Partitioning (2 replies)</title>
            <link>http://forums.mysql.com/read.php?106,573576,573576#msg-573576</link>
            <description><![CDATA[ Hi,<br />
We need to partition few of the tables growing larger. We have designed identifier (Through application)to have the 64 bit primary key with milliseconds(41 bits), 1 bit for signed and 22 bits sequence value to support partitioning. we would like to partition based on the primary key RANGE mainly to archive old data.<br />
Here is our one of the ddl.<br />
CREATE TABLE OB_ORDER<br />
(<br />
  CREATED_DATE 			TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,<br />
  CREATED_BY 			INT UNSIGNED NOT NULL,<br />
  LAST_MODIFIED_DATE TIMESTAMP NOT NULL,<br />
  LAST_MODIFIED_BY 		INT UNSIGNED NOT NULL,<br />
  ID 					BIGINT UNSIGNED NOT NULL ,<br />
  NAME 					VARCHAR(512),<br />
  ACC_ID 				INT UNSIGNED,<br />
  ORDER_NUMBER 			VARCHAR(32),<br />
  ORDER_DATE 			TIMESTAMP NULL DEFAULT NULL,<br />
  FULLFILL_DATE 		TIMESTAMP NULL DEFAULT NULL,<br />
  STATE 				INT,<br />
  PARTY_ROLE_ID			INT UNSIGNED,<br />
  PRICE_EFFECTIVE_DATE 	TIMESTAMP  NULL DEFAULT NULL,<br />
  TERM 					DECIMAL(38,10),<br />
  CONTRACT_ID 			INT UNSIGNED,<br />
  CONTRACT_VERSION 		VARCHAR(32),<br />
  ACC_CONTACT_ID 		INT UNSIGNED,<br />
CONSTRAINT ORDER_PK <br />
  PRIMARY KEY(ID),<br />
  CONSTRAINT OB_ORDER_FK <br />
  FOREIGN KEY (CONTRACT_ID)<br />
  REFERENCES OB_CONTRACT(ID),<br />
  CONSTRAINT ORDER_NUMBER_UC<br />
  UNIQUE(ORDER_NUMBER)<br />
  ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;<br />
<br />
<br />
Please provide me the function to get milliseconds equivaalent to what we get in java using (Calendar lCDateTime = Calendar.getInstance();<br />
    date = lCDateTime.getTimeInMillis();)<br />
<br />
I tried with SELECT UNIX_TIMESTAMP(); but when cross verified it with FROM_UNIXTIME function it was showing me only date and time and not milliseconds.<br />
<br />
Thanks well in advance.]]></description>
            <dc:creator>Manjunath C</dc:creator>
            <category>Partitioning</category>
            <pubDate>Wed, 14 Nov 2012 10:17:13 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,572155,572155#msg-572155</guid>
            <title>Does partitioning make sense for this application? (7 replies)</title>
            <link>http://forums.mysql.com/read.php?106,572155,572155#msg-572155</link>
            <description><![CDATA[ I'm designing an applicaton for internal use.  I'm a senior security analyst, not a DBA and not a programmer.  Such is life at an edu. :-)<br />
<br />
I've written the basic application in php (5.4.7) to use mysql (5.5.2) as the backend.  The purpose of the application is to speed up searches for data stored in binary form.  The average day is about 90GB of data.  The database will contain the critical elements we search on.  One day of data creates a 9GB table with over 120 million rows.  The indexes are almost 2GB.<br />
<br />
Here's the schema:<br />
+-------+-----------------------+------+-----+---------+-------+<br />
| Field | Type                  | Null | Key | Default | Extra |<br />
+-------+-----------------------+------+-----+---------+-------+<br />
| seq   | int(10) unsigned      | YES  |     | NULL    |       |<br />
| stime | double(18,6) unsigned | NO   | MUL | NULL    |       |<br />
| saddr | varchar(64)           | NO   | MUL | NULL    |       |<br />
| sport | varchar(10)           | NO   |     | NULL    |       |<br />
| daddr | varchar(64)           | NO   | MUL | NULL    |       |<br />
| dport | varchar(10)           | NO   |     | NULL    |       |<br />
| pkts  | bigint(20)            | YES  |     | NULL    |       |<br />
| bytes | bigint(20)            | YES  |     | NULL    |       |<br />
| state | varchar(32)           | YES  |     | NULL    |       |<br />
| proto | varchar(16)           | NO   |     | NULL    |       |<br />
+-------+-----------------------+------+-----+---------+-------+<br />
10 rows in set (0.00 sec)<br />
<br />
stime, saddr and daddr are indexed, because those are the elements we normally search for.<br />
<br />
Here's what the data looks like:<br />
<br />
+-----------+-------------------+----------------+-------+---------------+-------+------+-------+-------+-------+<br />
| seq       | stime             | saddr          | sport | daddr         | dport | pkts | bytes | state | proto |<br />
+-----------+-------------------+----------------+-------+---------------+-------+------+-------+-------+-------+<br />
| 105807958 | 1349121595.971430 | 10.174.37.162  | 63460 | 68.71.220.62  | 443   |    2 |   120 | A_A   | tcp   |<br />
| 105807959 | 1349121595.971592 | 10.21.16.47    | 53600 | 64.208.241.65 | 80    |   75 | 68566 | PA_PA | tcp   |<br />
| 105807960 | 1349121595.971961 | 129.110.31.40  | 39605 | 217.70.185.0  | 53    |    1 |    87 | INT   | udp   |<br />
| 105807961 | 1349121595.972484 | 74.125.225.134 | 80    | 10.21.1.146   | 61692 |    1 |    60 | _RA   | tcp   |<br />
| 105807962 | 1349121595.973084 | 10.21.16.178   | 53433 | 74.125.225.99 | 80    |    5 |  2519 | PA_PA | tcp   |<br />
| 105807963 | 1349121595.974383 | 10.190.104.195 | 59254 | 66.94.240.25  | 80    |    2 |   120 | A_FA  | tcp   |<br />
| 105807964 | 1349121595.974762 | 10.190.101.245 | 62995 | 75.102.13.140 | 80    |   89 | 48592 | A_PA  | tcp   |<br />
| 105807965 | 1349121595.974790 | 10.110.143.140 | 54014 | 64.4.44.48    | 1863  |    3 |   182 | PA_PA | tcp   |<br />
| 105807966 | 1349121595.974874 | 10.21.21.50    | 15326 | 121.9.201.100 | 17788 |    2 |   241 | INT   | udp   |<br />
| 105807967 | 1349121595.975586 | 10.170.40.197  | 49993 | 70.20.201.40  | 18879 |    8 |   668 | A_PA  | tcp   |<br />
+-----------+-------------------+----------------+-------+---------------+-------+------+-------+-------+-------+<br />
10 rows in set (0.08 sec)<br />
<br />
The stime column is the unixtime date/time plus six digits representing the microseconds.<br />
<br />
Eventually the data will be streamed in realtime into the db.  So each day another 120 million rows will be added to the database.<br />
<br />
Most of the queries I've written return a result in less than a second.  Some can take up to 9 seconds.  I would assume that adding a second day would double these query times.<br />
<br />
  So I'm looking in to partitioning.  For my application, the most logical way to partition would be by the day.  Generally, when we do searches, they are for discrete time intervals within a 24 hour period, so most searches would only traverse one partition.<br />
<br />
Does this make sense?<br />
<br />
Since the stime column is indexed, it would make sense to partition on that (if I'm reading the docs correctly).  I believe those times are unique, so this could be made a primary key.<br />
<br />
The problem is, I would need to either create hundreds of partitions in advance somehow or, more optimally, create a partition on the fly during the day for the next day's data.<br />
<br />
Is it possible to do this?  Can anyone give me some hints on how to do this?<br />
<br />
EDIT: Unfortunately, stime has duplicate values, so it cannot be a primary key.  Only seq is unique, but we don't search on that.<br />
<br />
EDIT2: I should have mentioned that the inserts will be done by the same program that creates the log files.  It has the capability of creating a new table each day.  It also assigns the data type to each field but does not do any indexing.  So I would have to write something to create the indexes later (which is not a big deal.)<br />
<br />
My concern is that with uniquely named daily tables, my code has to be a lot more sophisticated.  Searching over multiple days would require lots of joins, whereas a paritioned table would not.<br />
<br />
I could use the program to create a new table each month and partition that, which would mean 12 tables per year with no more than 31 partitions in each table.  I'm not sure how much data we will be keeping.  Right now we keep about 25 days on a 1TB drive.  That consumes about 950GB of data.  The same time frame in the db would be 95GB.]]></description>
            <dc:creator>Paul Schmehl</dc:creator>
            <category>Partitioning</category>
            <pubDate>Tue, 30 Oct 2012 18:15:46 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,571804,571804#msg-571804</guid>
            <title>Programatic Partitioning (no replies)</title>
            <link>http://forums.mysql.com/read.php?106,571804,571804#msg-571804</link>
            <description><![CDATA[ I would like to know if somebody hear about programatic partitioning...<br />
<br />
Some solution based in programatic partitioning like a function in application that change the partition.<br />
<br />
Some peaple ask me about this and I never listened nothing about.<br />
<br />
Thanks for wile<br />
<br />
Jardel]]></description>
            <dc:creator>Jardel Jardel</dc:creator>
            <category>Partitioning</category>
            <pubDate>Mon, 22 Oct 2012 10:44:10 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,571651,571651#msg-571651</guid>
            <title>Partitioning not working need primary key? (18 replies)</title>
            <link>http://forums.mysql.com/read.php?106,571651,571651#msg-571651</link>
            <description><![CDATA[ Dear All,<br />
         We are trying some partitioning as below.<br />
<br />
ALTER TABLE tblreceipt  PARTITION BY RANGE (MONTH(receiptDate))<br />
(   <br />
PARTITION p1 VALUES LESS THAN (TO_DAYS('2012-10-20')),<br />
PARTITION p2 VALUES LESS THAN (TO_DAYS('2012-10-21')), <br />
PARTITION p3 VALUES LESS THAN (TO_DAYS('2012-10-22'))<br />
); <br />
<br />
but end up with this Error Code: 1503<br />
A PRIMARY KEY must include all columns in the table's partitioning function]]></description>
            <dc:creator>newbie Shai</dc:creator>
            <category>Partitioning</category>
            <pubDate>Sat, 03 Nov 2012 17:37:07 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,570683,570683#msg-570683</guid>
            <title>Row movement for MySQL partitionned tables (1 reply)</title>
            <link>http://forums.mysql.com/read.php?106,570683,570683#msg-570683</link>
            <description><![CDATA[ I am currently considering partitionning tables on my company's application and i was unable to find anywhere in the documentation anything about row movement.<br />
<br />
How does MySQL partitionned tables handle updates on records that would move the record from one partition to another?<br />
<br />
Exemple : table1 is a InnoDB table partitionned on the value of col1 which is an integer value.<br />
<br />
The value of col1 for each record of table one will increase from 0 to 6 at different point of the time through UPDATE queries. <br />
What happends when a record is updated to have its col1 value change from 0 to 1 ? Does it trigger an error? Does MySQL delete the record from p0 and inserts a new one into p1?<br />
<br />
Thanks!]]></description>
            <dc:creator>jongse park</dc:creator>
            <category>Partitioning</category>
            <pubDate>Thu, 11 Oct 2012 11:32:23 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,570603,570603#msg-570603</guid>
            <title>columns partitioning row inserted in wrong partition (1 reply)</title>
            <link>http://forums.mysql.com/read.php?106,570603,570603#msg-570603</link>
            <description><![CDATA[ Hello,<br />
 Let t be the following table:<br />
 CREATE TABLE t(<br />
   `a` tinyint(3) unsigned NOT NULL,<br />
   `b` tinyint(3) unsigned NOT NULL<br />
 ) ENGINE=MyISAM<br />
 PARTITION BY RANGE  COLUMNS(a,b)<br />
 (PARTITION p1 VALUES LESS THAN (54,54) ENGINE = MyISAM,<br />
 PARTITION p2 VALUES LESS THAN (54,106) ENGINE = MyISAM,<br />
 PARTITION p3 VALUES LESS THAN  (54,164) ENGINE = MyISAM,<br />
 PARTITION p4 VALUES LESS THAN (54,204) ENGINE = MyISAM,<br />
 PARTITION p5 VALUES LESS THAN (54,MAXVALUE) ENGINE = MyISAM,<br />
 PARTITION p6 VALUES LESS THAN (106,54) ENGINE = MyISAM,<br />
 PARTITION p7 VALUES LESS THAN (164,54) ENGINE = MyISAM,<br />
 PARTITION p8 VALUES LESS THAN (204,54) ENGINE = MyISAM,<br />
 PARTITION p9 VALUES LESS THAN (MAXVALUE,54) ENGINE = MyISAM);<br />
 <br />
the row (1,1) is correctly inserted in p1.<br />
 Why the row (1,100) is inserted in p1 and not in p2, as I expected?<br />
 Thanks,<br />
 Martino]]></description>
            <dc:creator>Martino Merci</dc:creator>
            <category>Partitioning</category>
            <pubDate>Wed, 10 Oct 2012 17:15:31 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,570451,570451#msg-570451</guid>
            <title>Get partition name for specific date (3 replies)</title>
            <link>http://forums.mysql.com/read.php?106,570451,570451#msg-570451</link>
            <description><![CDATA[ Hi,<br />
<br />
for an InnoDB table historical_offers with a field <br />
`valid_at` date NOT NULL DEFAULT '0000-00-00'<br />
and the partitioning<br />
PARTITION BY KEY(valid_at) PARTITIONS 92<br />
<br />
I want to get the partition name for a specific date, so that I can truncate that partition, e.g.<br />
ALTER TABLE historical_offers TRUNCATE PARTITION date_to_partition_name('2012-09-28')<br />
where date_to_partition_name is what I am looking for.<br />
<br />
I tried calculating modulo 92 the number of days since 0000-01-01 and 1970-01-01, but I got wrong numbers.<br />
<br />
Thanks, Jan]]></description>
            <dc:creator>Jan Bromberger</dc:creator>
            <category>Partitioning</category>
            <pubDate>Fri, 12 Oct 2012 01:12:39 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,570417,570417#msg-570417</guid>
            <title>Regarding optimizing hugh data with mysql (1 reply)</title>
            <link>http://forums.mysql.com/read.php?106,570417,570417#msg-570417</link>
            <description><![CDATA[ Hi All,<br />
<br />
I have around more than 26 crores of data in my mysql table.<br />
<br />
I am using myIsam engine.<br />
<br />
I need to optimize this table for better performance.<br />
<br />
I have 5 rows in my table.<br />
<br />
Everyday there is insert, update, select happening on this table.<br />
<br />
Someone has suggested me to use mysql partitioning.<br />
<br />
Please advice me how to use/steps mysql partitioning<br />
<br />
Regards<br />
Santosh]]></description>
            <dc:creator>Santosh Bhabal</dc:creator>
            <category>Partitioning</category>
            <pubDate>Wed, 10 Oct 2012 05:23:22 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,569691,569691#msg-569691</guid>
            <title>Prunning partitions with range by date (2 replies)</title>
            <link>http://forums.mysql.com/read.php?106,569691,569691#msg-569691</link>
            <description><![CDATA[ Hi all,<br />
<br />
I created the following test table:<br />
<br />
CREATE TABLE `test` (<br />
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,<br />
  `ins_date` datetime NOT NULL,<br />
  PRIMARY KEY (`id`, `ins_date`)<br />
) ENGINE=InnoDB DEFAULT CHARSET=utf8<br />
PARTITION BY RANGE ( TO_DAYS(`ins_date`) ) (<br />
	PARTITION pre_year VALUES LESS THAN (TO_DAYS('2012-01-01')),<br />
	PARTITION cur_year_jan VALUES LESS THAN (TO_DAYS('2012-02-01')),<br />
	PARTITION cur_year_feb VALUES LESS THAN (TO_DAYS('2012-03-01')),<br />
	PARTITION cur_year_mar VALUES LESS THAN (TO_DAYS('2012-04-01')),<br />
	PARTITION cur_year_may VALUES LESS THAN (TO_DAYS('2012-05-01')),<br />
	PARTITION cur_year_apr VALUES LESS THAN (TO_DAYS('2012-06-01')),<br />
	PARTITION cur_year_jun VALUES LESS THAN (TO_DAYS('2012-07-01')),<br />
	PARTITION cur_year_jul VALUES LESS THAN (TO_DAYS('2012-08-01')),<br />
	PARTITION cur_year_aug VALUES LESS THAN (TO_DAYS('2012-09-01')),<br />
	PARTITION cur_year_sep VALUES LESS THAN (TO_DAYS('2012-10-01')),<br />
	PARTITION cur_year_oct VALUES LESS THAN (TO_DAYS('2012-11-01')),<br />
	PARTITION cur_year_nov VALUES LESS THAN (TO_DAYS('2012-12-01')),<br />
	PARTITION cur_year_dec VALUES LESS THAN (TO_DAYS('2013-01-01')),<br />
	PARTITION nex_year VALUES LESS THAN (MAXVALUE)<br />
);<br />
<br />
The table has these partitions:<br />
- one partition for all records prior to 2012-01-01<br />
- 12 partions for year 2012 (one for each month)<br />
- one partition for all records after 2102-12-31<br />
<br />
The objective was to test prunning behaivor. To achieve this, I inserted some records into this table:<br />
<br />
-- Records for 2011<br />
insert into test set ins_date = '2011-01-01';<br />
insert into test set ins_date = '2011-02-02';<br />
insert into test set ins_date = '2011-03-03';<br />
insert into test set ins_date = '2011-04-04';<br />
insert into test set ins_date = '2011-05-05';<br />
insert into test set ins_date = '2011-06-06';<br />
insert into test set ins_date = '2011-07-07';<br />
insert into test set ins_date = '2011-08-08';<br />
insert into test set ins_date = '2011-09-09';<br />
insert into test set ins_date = '2011-10-10';<br />
insert into test set ins_date = '2011-11-11';<br />
insert into test set ins_date = '2011-12-12';<br />
<br />
-- Records for 2012<br />
insert into test set ins_date = '2012-01-01';<br />
insert into test set ins_date = '2012-02-02';<br />
insert into test set ins_date = '2012-03-03';<br />
insert into test set ins_date = '2012-04-04';<br />
insert into test set ins_date = '2012-05-05';<br />
insert into test set ins_date = '2012-06-06';<br />
insert into test set ins_date = '2012-07-07';<br />
insert into test set ins_date = '2012-08-08';<br />
insert into test set ins_date = '2012-09-09';<br />
insert into test set ins_date = '2012-10-10';<br />
insert into test set ins_date = '2012-11-11';<br />
insert into test set ins_date = '2012-12-12';<br />
<br />
-- Records for 2013<br />
insert into test set ins_date = '2013-01-01';<br />
insert into test set ins_date = '2013-02-02';<br />
insert into test set ins_date = '2013-03-03';<br />
insert into test set ins_date = '2013-04-04';<br />
insert into test set ins_date = '2013-05-05';<br />
insert into test set ins_date = '2013-06-06';<br />
insert into test set ins_date = '2013-07-07';<br />
insert into test set ins_date = '2013-08-08';<br />
insert into test set ins_date = '2013-09-09';<br />
insert into test set ins_date = '2013-10-10';<br />
insert into test set ins_date = '2013-11-11';<br />
insert into test set ins_date = '2013-12-12';<br />
<br />
So I executed this select statement<br />
<br />
EXPLAIN PARTITIONS SELECT * FROM test WHERE ins_date &gt;= '2012-09-01' AND ins_date &lt;= '2012-09-30';<br />
<br />
expecting that the list of prunned partitions would contain only &quot;cur_year_sep&quot;, but the result was &quot;pre_year,cur_year_sep&quot;.<br />
<br />
I would like to know if is this correct or I might consider it a bug?<br />
<br />
If I change the WHERE clause to &quot;WHERE ins_date = '2012-09-09'&quot; (using the &quot;equals&quot; operator) the explain statement shows me only &quot;cur_year_sep&quot;. However, I need to make use of &quot;greater than&quot; and &quot;lower than&quot; operators.<br />
<br />
Thanks in advance<br />
<br />
Diogo]]></description>
            <dc:creator>Diogo Domanski</dc:creator>
            <category>Partitioning</category>
            <pubDate>Thu, 27 Sep 2012 21:00:33 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,569507,569507#msg-569507</guid>
            <title>Partitioning help (3 replies)</title>
            <link>http://forums.mysql.com/read.php?106,569507,569507#msg-569507</link>
            <description><![CDATA[ Hi,<br />
<br />
I am new to MySql partitioning. I need some help on partitioning my tables.<br />
<br />
My db is having 2 tables:<br />
<br />
Table T1:<br />
Schema: (C1 int auto_incr PK, C2 int not null,c3....)<br />
Total Records: 2.5Million<br />
Partitioning col: C2(Range partition with 6 partitions)<br />
<br />
Table T2;<br />
Schema: (D1 int auto_incr PK, C1 FK to T1, D2,D3,...)<br />
TotalRecords: &gt;6Million<br />
<br />
Question here is, Can I make partitions for T2 based on C2 as they are more co related.]]></description>
            <dc:creator>Naresh Kumar Kondeboina</dc:creator>
            <category>Partitioning</category>
            <pubDate>Tue, 02 Oct 2012 05:54:41 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,569394,569394#msg-569394</guid>
            <title>Partitioning by year/quarter (2 replies)</title>
            <link>http://forums.mysql.com/read.php?106,569394,569394#msg-569394</link>
            <description><![CDATA[ Hi: I have a datetime column in my table and I want to partition by quarter of every year for the next 5 years.  The table and partitions seems to have created fine. Not sure if this will work since quarter function returns an integer without the year. Can someone comment?<br />
<br />
<br />
<pre class="bbcode">
CREATE TABLE STATUS (
id NUMERIC(16) NOT NULL,
FIRSTOCCURRENCE DATETIME NOT NULL,
PRIMARY KEY ( ID,FIRSTOCCURRENCE )
)

PARTITION BY RANGE (QUARTER(FIRSTOCCURRENCE))
(
        PARTITION p2012_3 values less than (20123),
        PARTITION p2012_4 values less than (20124),
        PARTITION p2013_1 values less than (20131),
        PARTITION p2013_2 values less than (20132),
        PARTITION p2013_3 values less than (20133),
        PARTITION p2013_4 values less than (20134),
        PARTITION p2014_1 values less than (20141),
        PARTITION p2014_2 values less than (20142),
        PARTITION p2014_3 values less than (20143),
        PARTITION p2014_4 values less than (20144),
        PARTITION p2015_1 values less than (20151),
        PARTITION p2015_2 values less than (20152),
        PARTITION p2015_3 values less than (20153),
        PARTITION p2015_4 values less than (20154),
        PARTITION p2016_1 values less than (20161),
        PARTITION p2016_2 values less than (20162),
        PARTITION p2016_3 values less than (20163),
        PARTITION p2016_4 values less than (20164),
        PARTITION p2017_1 values less than (20171),
        PARTITION p2017_2 values less than (20172),
        PARTITION p2017_3 values less than (20173),
        PARTITION p2017_4 values less than (20174),
        PARTITION p2018_1 values less than (MAXVALUE)
);
</pre>]]></description>
            <dc:creator>Ravi Malghan</dc:creator>
            <category>Partitioning</category>
            <pubDate>Wed, 03 Oct 2012 03:15:38 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,568316,568316#msg-568316</guid>
            <title>What Method is Best (3 replies)</title>
            <link>http://forums.mysql.com/read.php?106,568316,568316#msg-568316</link>
            <description><![CDATA[ Hi forum. I have a partitioned table that receives queries based upon a range between two different date fields.  Those date fields are:<br />
<br />
startTime  TIMESTAMP<br />
endTime    TIMESTAMP<br />
<br />
I would like to deploy RANGE type partitioning based upon endTime, that much is a no-brainer.  However, when I perform a query as follows:<br />
<br />
WHERE startTime BETWEEN 'A' AND 'B' OR endTime BETWEEN 'B' AND 'C'<br />
<br />
I would like the partition to know about the startTime ranges in my various partitions, so that the pruning algorythim does not have to perform a full scan of all partitions.<br />
<br />
I don't think the answer is sub partitions.  Please let me know your thoughts.<br />
<br />
TheWitness]]></description>
            <dc:creator>Larry Adams</dc:creator>
            <category>Partitioning</category>
            <pubDate>Sat, 15 Sep 2012 05:11:23 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,566620,566620#msg-566620</guid>
            <title>timestamp, datetime as default value as current_timestamp [PARTITION] (14 replies)</title>
            <link>http://forums.mysql.com/read.php?106,566620,566620#msg-566620</link>
            <description><![CDATA[ I have a table column called 'recorddate' where it has timestamp datatype to default CURRENT_TIMESTAMP. Now I have few questions regarding maintenance part.<br />
<br />
I should partition this table keeping recorddate as rangekey. But now it wouldn't allow partition key for timezone-dependent expressions in (sub)partitioning function.<br />
<br />
If I change the timestamp datatype to datetime for recorddate the partition is created but it won't allow default CURRENT_TIMESTAMP database level.<br />
<br />
2.1 . When I see forums stating MySQL 5.6.5 has datetime datatype can have CURRENT_TIMESTAMP, now(). Would it allow rangebykey for partition ? [Another thought that clings on my head is, would it be good to pick a distribution that is still under developement]<br />
<br />
Any suggestions or work around, I really don't like the concept of triggers having to be on recordate upon insert if null. As it seeds records almost 5hundered thousands perday and peak time goes to 8 transactions per second on that table. That is the intent of falling on to partitions.<br />
<br />
Thanks in advance!! Mannoj]]></description>
            <dc:creator>Mannoj Kumar</dc:creator>
            <category>Partitioning</category>
            <pubDate>Fri, 07 Sep 2012 11:49:42 +0000</pubDate>
        </item>
        <item>
            <guid>http://forums.mysql.com/read.php?106,566050,566050#msg-566050</guid>
            <title>particular field type not allowed to this type of partitioning (3 replies)</title>
            <link>http://forums.mysql.com/read.php?106,566050,566050#msg-566050</link>
            <description><![CDATA[ I need to create the table in the below format. But is returning the error in the partitioning area that is <br />
<br />
Error Code: 1659.Field 'fldassigndate' is of a not allowed type for this type of partitioning. How to resolve this error and make partitioning ?<br />
<br />
CREATE TABLE tblattendancesetup (<br />
  fldattendanceid int(11) NOT NULL AUTO_INCREMENT,<br />
  flddept varchar(100) DEFAULT NULL,<br />
  fldemployee varchar(100) DEFAULT NULL,<br />
  fldintime varchar(20) DEFAULT NULL,<br />
  fldouttime varchar(20) DEFAULT NULL,<br />
  fldlateafter varchar(20) DEFAULT NULL,<br />
  fldearlybefore varchar(20) DEFAULT NULL,<br />
  fldweekoff varchar(20) DEFAULT NULL,<br />
  fldshiftname varchar(20) DEFAULT NULL,<br />
  fldassigndate varchar(20) DEFAULT NULL,<br />
  fldfromdate varchar(20) DEFAULT NULL,<br />
  fldtodate varchar(20) DEFAULT NULL,<br />
  fldrefid varchar(20) DEFAULT NULL,<br />
  UNIQUE KEY fldattendanceid (fldattendanceid),<br />
  KEY in_attendancesetup (fldemployee,fldintime,fldouttime,fldlateafter,fldearlybefore,fldfromdate,fldtodate,fldattendanceid),<br />
  KEY i_emp_tmp (fldemployee),<br />
  KEY i_emp_attendance (fldemployee)<br />
)<br />
 PARTITION BY RANGE (fldassigndate)<br />
(PARTITION p_Apr VALUES LESS THAN (TO_DAYS('2012-05-01')),<br />
 PARTITION p_May VALUES LESS THAN (TO_DAYS('2012-06-01')),<br />
 PARTITION p_Nov VALUES LESS THAN MAXVALUE );]]></description>
            <dc:creator>dhileepan mahendran</dc:creator>
            <category>Partitioning</category>
            <pubDate>Fri, 24 Aug 2012 10:15:20 +0000</pubDate>
        </item>
    </channel>
</rss>
