Jump to content


Photo

RENAME TABLE and indexes


  • Please log in to reply
3 replies to this topic

#1 richswww

richswww
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 04 August 2006 - 02:41 PM

(Possibly) dumb question:

Let's say I have table foo with an index called myindex.

If I do "RENAME TABLE foo TO bar" ...

Will the "myindex" index be attached to the new table "bar", or should I drop the "myindex" index from the foo table and recreate it on the "bar" table after the rename?

Thanks,
Rich Stephens

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 04 August 2006 - 03:03 PM

Renaming the table should have no effect on any indexes in said table, at least in MyISAM.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 richswww

richswww
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 04 August 2006 - 05:28 PM

So, by "no effect", you mean, the index should still be in place, so no need to drop and recreate them?

Rich S.

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 04 August 2006 - 09:14 PM

That's correct... at least for MyISAM, the table name is simple the file name of the underlying data and index files, so they don't even "know" about the change.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users