Results 1 to 4 of 4

Thread: slow query

  1. #1
    Join Date
    Jun 2004
    Posts
    2

    Unanswered: 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

  2. #2
    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?

  3. #3
    Join Date
    Jun 2004
    Posts
    2

    yes it is

    taskid is indexed.

  4. #4
    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •