If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > slow query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-30-04, 05:32
rainy81 rainy81 is offline
Registered User
 
Join Date: Jun 2004
Posts: 2
slow query

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.

Query1--
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)


Query2--
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
Reply With Quote
  #2 (permalink)  
Old 06-30-04, 10:50
megadeth72 megadeth72 is offline
Registered User
 
Join Date: Jun 2004
Posts: 7
Quote:
Originally Posted by rainy81
IWHERE taskid BETWEEN '379' AND '384';
Query OK, 6 rows affected (4.47 sec)
Records: 6 Duplicates: 0 Warnings: 0
Is taskid indexed?
Reply With Quote
  #3 (permalink)  
Old 07-05-04, 01:32
rainy81 rainy81 is offline
Registered User
 
Join Date: Jun 2004
Posts: 2
yes it is

taskid is indexed.
Reply With Quote
  #4 (permalink)  
Old 07-11-04, 23:25
yellowmarker yellowmarker is offline
Registered User
 
Join Date: Jul 2004
Location: Dundee, Scotland
Posts: 107
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?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On