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',

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);
  • Partitioning does not support foreign keys. – Abdul Manaf Jun 21 '12 at 4:45

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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