I have two queries.
1. one dumps some contents from one database to another
2. second dumps some contents from one table to another inside the same database.
I find the second query very slow.Please help me.
INSERT INTO devendor.job (taskid,inputxml,status) SELECT dw.taskid, dw.rawdata,'f' FROM demaster.workbasket as dw WHERE dw.taskid BETWEEN '379' AND '384';
Query OK, 8 rows affected (0.02 sec)
INSERT INTO assignment(taskid,inputxml,keydetail) SELECT dw.taskid,dw.rawdata,dw.keydetail FROM workbasket as dw WHERE taskid BETWEEN '379' AND '384';
Query OK, 6 rows affected (4.47 sec)
Records: 6 Duplicates: 0 Warnings: 0
With the information you have posted there is no obvious answer so more information would be helpful. There is no way that the time difference is to do with copying the data from one table to another inside the same database / from one database to another.
What are the differences? What does keydetail contain & how is the field defined? Why were 6 rows affected in the first query then 8 rows affected in the second query? How many rows are in the table? Are other processes using the database at the same time? Is table locking an issue?