tags:

views:

26

answers:

1

Ok so I was wondering if there is a big difference performance and efficiency wise between creating a table in MySQL with a full Create table statement vs. Copying the structure of another table that has the same layout. I ask because there are going to be multiple, and I mean a lot, of tables being created so I wanted to see if copying would help relieve some stress on the server vs just using full statements to create them.

EDIT: Yes I am talking about using the CREATE TABLE...LIKE... I just wanted to know if there was any performance difference

A: 

If you're talking about using a CREATE TABLE tbl LIKE other_tbl, I'm pretty sure MySQL just performs a normal CREATE TABLE statement using the layout of other_tbl

davidcelis
Yes that was what I meant however I was wondering if there was any performance difference
Anon
I don't believe there would be any performance difference; MySQL should be using other_tbl's create statement to copy the table, so it ends up being another CREATE_TABLE statement (though I don't know if certain things such as indices also copy over)You may already know this, but you can do "SHOW CREATE TABLE tbl" to get a runnable CREATE TABLE statement for tbl. CREATE TABLE LIKE likely uses this.
davidcelis