什么是复制mysql行的最快方法?

I've got to copy some mysql rows before pages load. I tried to copy it to a temp table, something like this:

 mysqli_query($con,"CREATE TEMPORARY TABLE tmp_tbl SELECT * FROM subject WHERE ID='$ID'");
 mysqli_query($con,"UPDATE tmp_tbl SET ID=NULL");
 mysqli_query($con,"INSERT INTO subject SELECT * FROM tmp_tbl");
 mysqli_query($con,"DROP TABLE tmp_tbl");`

It works pretty slow. Does just copying it in the regular ugly way would be faster?

edit: when you want to update multiple rows you can do somthing like this:

 mysqli_query($con,"INSERT INTO subject (Primary,AnotherID, COLB, COLC)
SELECT NULL,'$a', COLB, COLC
FROM subject WHERE AnotherID='$someID'");

You must put a null in the primary key, otherwise its doesnt work

You can certainly speed this up, but the overall speed will be determined by the number of rows in the subject table - after all your queries double its size.

For this example I'm assuming the subject table columns are ID, ColA, ColB, and ColC, and that ID is an auto-incrementing primary key:

INSERT INTO subject (ColA, ColB, ColC)
SELECT ColA, ColB, ColC
FROM subject

The key is to specify every column except ID when inserting/selecting.