in reply to Basic Perl trumps DBI? Or my poor DB design?

DB2 should be many times faster than DB1. If it isn't, you're doing something wrong. For one thing, I see you put in placeholders for the SQL but don't seem to be passing it any values. Also, the SQL is very different between these. For DB1 and DB2 you are supplying values for response but on the others you just join on respondent.

I strongly recommend that you learn how to use the EXPLAIN command in MySQL to determine if your indexes are correct. A correctly indexed table is the best way to approach this problem.

  • Comment on Re: Basic Perl trumps DBI? Or my poor DB design?

Replies are listed 'Best First'.
Re^2: Basic Perl trumps DBI? Or my poor DB design?
by pg (Canon) on Oct 23, 2004 at 08:03 UTC
    "For one thing, I see you put in placeholders for the SQL but don't seem to be passing it any values."

    This is quite strange actually. I never used MySQL, but I would expect it to throw SQL error just like Oracle does, when not all variables are bind. I think we are not getting all the facts. The actual code used for testing might be a little bit different.

      Yes, sorry 'bout that - the basic benchmark routine was adjusted for the needs of each sql statement, but I thought my post was long-winded enough. Can always count on Monks' eye for detail....