Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Is there a way that I can create a month-year partition on the below table? Without having to define all the permuations of month/year combos ?

CREATE TABLE  visitor_visits (
  id int(10) UNSIGNED NOT NULL auto_increment,
  visitor_id int(10) UNSIGNED NOT NULL,
  source varchar(64) NULL DEFAULT NULL DEFAULT NULL,
  medium varchar(64) NULL DEFAULT NULL,
  campaign varchar(256) NULL DEFAULT NULL,
  page varchar(32) NULL DEFAULT NULL,
  landing varchar(32) NULL DEFAULT NULL,
  type enum('fundraiser_view') NULL DEFAULT NULL,
  visit_date date NOT NULL default '0000-00-00',
  created_at datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; 

ALTER TABLE visitor_visits ADD UNIQUE INDEX (visitor_id,type,visit_date);
ALTER TABLE visitor_visits ADD CONSTRAINT FK_visits_visitor_id FOREIGN KEY (visitor_id) REFERENCES visitors(id);
share|improve this question
    
Partitioning does not support foreign keys. –  Abdul Manaf Jun 21 '12 at 4:45
add comment

1 Answer

Sorry, you must create the PARTITIONs yourself. I would do it in Perl; do you know that language, or some other?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.