MySQL Forums
Forum List  »  Partitioning

Re: slower queries after partitioning
Posted by: Mat private
Date: October 23, 2010 10:57AM

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

Options: ReplyQuote


Subject
Views
Written By
Posted
6577
October 21, 2010 11:46AM
2694
October 23, 2010 01:24AM
2120
October 23, 2010 08:44AM
2414
October 23, 2010 09:43AM
1855
October 23, 2010 10:48AM
Re: slower queries after partitioning
1744
October 23, 2010 10:57AM
1881
October 23, 2010 06:09PM
1665
October 24, 2010 02:30AM
1696
October 25, 2010 07:39AM
1674
October 25, 2010 08:04AM


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.