Re: slower queries after partitioning
one small question about:
"and have this
KEY `TickerID` (`TickerID`, DBDate)
instead of
KEY `TickerID` (`TickerID`)
"
I had a primairy key (`TickerID`, DBDate) and added the key `TickerID` (`TickerID`) just so I could use a foreign key with the tickers table, like this:
CREATE TABLE `quotes` (
`DBDate` int(11) unsigned NOT NULL,
`TickerID` int(11) unsigned NOT NULL,
`Open` double(12,4) NOT NULL,
`High` double(12,4) default NULL,
`Low` double(12,4) default NULL,
`Close` double(12,4) default NULL,
`AdjClose` double(12,4) default NULL,
`Volume` int(11) unsigned NOT NULL,
PRIMARY KEY (`DBDate`,`TickerID`),
KEY `TickerID` (`TickerID`),
CONSTRAINT `Quotes_fk_TickerID1` FOREIGN KEY (`TickerID`) REFERENCES `tickers` (`TickerID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC
Is there a way to make a foreign key if I only have a key like (`TickerID`, DBDate)?
regards,
Matthijs