Skip navigation links

MySQL Forums :: Partitioning :: Get partition name for specific date


Advanced Search

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 1482 Jan Bromberger 10/08/2012 12:48PM
Re: Get partition name for specific date 899 Rick James 10/09/2012 09:21AM
Re: Get partition name for specific date 820 Jan Bromberger 10/10/2012 03:18AM
Re: Get partition name for specific date 840 Rick James 10/11/2012 07:12PM


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.