vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| When you create a foreign key, is an index also created for the same column? I have searched around for the answer on this and I have gotten conflicting answers. They way mysql works, is this the same for all databases? Thanks for the help. |
| |||
| On Mon, 21 Apr 2008 09:05:23 -0700 (PDT), chris wrote: > When you create a foreign key, is an index also created for the same > column? I have searched around for the answer on this and I have > gotten conflicting answers. Depends on the version. In Mysql version 4.1.2 and later, the InnoDB engine will build the index automatically. Prior versions needed the index to be created beforehand, and then specified when you're actually declaring the FK. > They way mysql works, is this the same for all databases? Yes, the same for all databases, because this is version-dependant behavior. -- I think I'd like to see a Simpsons episode starting up with Bart Simpson writing "I will not attempt to undermine the Usenet Cabal". -- J. D. Falk |
| ||||
| On Apr 21, 10:49*am, "Peter H. Coffin" <hell...@ninehells.com> wrote: > On Mon, 21 Apr 2008 09:05:23 -0700 (PDT), chris wrote: > > When you create a foreign key, is an index also created for the same > > column? *I have searched around for the answer on this and I have > > gotten conflicting answers. > > Depends on the version. In Mysql version 4.1.2 and later, the InnoDB > engine will build the index automatically. Prior versions needed the > index to be created beforehand, and then specified when you're actually > declaring the FK. > > > They way mysql works, is this the same for all databases? > > Yes, the same for all databases, because this is version-dependant > behavior. > > -- > I think I'd like to see a Simpsons episode starting up with Bart Simpson > writing "I will not attempt to undermine the Usenet Cabal". > * * * * * * * -- J. D. Falk Hey Peter, Thanks for clearing that up. |
| Thread Tools | |
| Display Modes | |
| |