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
7918
October 21, 2010 11:46AM
3204
October 23, 2010 01:24AM
2517
October 23, 2010 08:44AM
2783
October 23, 2010 09:43AM
2170
October 23, 2010 10:48AM
Re: slower queries after partitioning
2127
October 23, 2010 10:57AM
2218
October 23, 2010 06:09PM
1958
October 24, 2010 02:30AM
1994
October 25, 2010 07:39AM
2019
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.