MySQL Forums
Forum List  »  Partitioning

Re: Partitioning by year/quarter
Posted by: Aftab Khan
Date: September 27, 2012 01:31PM

One way to accomplish this is to create a table partitioned by LIST, using the YEAR and QUARTER() function in the partitioning expression
mysql> select YEAR(now()) * 100 + QUARTER(now());
+------------------------------------+
| YEAR(now()) * 100 + QUARTER(now()) |
+------------------------------------+
|                             201203 |
+------------------------------------+
1 row in set (0.00 sec)

e.g.

PARTITION BY LIST(YEAR(FIRSTOCCURRENCE) * 100 + QUARTER(FIRSTOCCURRENCE)) (
    PARTITION y2012q3 VALUES IN(201203),
    PARTITION y2012q4 VALUES IN(201204),
....
);

Options: ReplyQuote


Subject
Views
Written By
Posted
4621
September 24, 2012 10:32AM
Re: Partitioning by year/quarter
2231
September 27, 2012 01:31PM
1583
October 02, 2012 09:15PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.