MySQL Forums
Forum List  »  Partitioning

Get partition name for specific date
Posted by: Jan Bromberger
Date: October 08, 2012 12:48PM

Hi,

for an InnoDB table historical_offers with a field
`valid_at` date NOT NULL DEFAULT '0000-00-00'
and the partitioning
PARTITION BY KEY(valid_at) PARTITIONS 92

I want to get the partition name for a specific date, so that I can truncate that partition, e.g.
ALTER TABLE historical_offers TRUNCATE PARTITION date_to_partition_name('2012-09-28')
where date_to_partition_name is what I am looking for.

I tried calculating modulo 92 the number of days since 0000-01-01 and 1970-01-01, but I got wrong numbers.

Thanks, Jan

Options: ReplyQuote


Subject
Views
Written By
Posted
Get partition name for specific date
3057
October 08, 2012 12:48PM


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.