in reply to DB Question, speed is the answer!

How many rows in the table, and how much does the serial column filter? If the filter on the 'serial' column filters a significant percentage, you might get good results from an index on that column, and maybe changing the filter to mastertable.serial in ('FF', 'CC', 'OO', 'NN' ). Then again, maybe not, because some databases would just convert the 'in' clause to joined 'or' clauses like you have anyway. Getting a query plan would help (do you know how to get one for your database?).

Also (unrelated), use RaiseError. You are checking the connect and execute, but not the fetch.

Replies are listed 'Best First'.
Re^2: DB Question, speed is the answer!
by Anonymous Monk on Jan 14, 2005 at 19:54 UTC
    No, I don't know how to get a query plan, can you explain how, thank you!
      I don't know how to get a query plan, can you explain how, thank you!
      It's a database specific question, and I don't know anything about AS400 databases, so, no. You'd have to talk to your database guys or read the database documentation. Though you could answer the other questions and figure out (guess) for yourself whether or not an index might be worthwhile.