in reply to mod_perl was hosed by a bind variable

You must have been preparing the query every time then. The fastest way to use DBI is with prepare_cached() and bind variables. This is in the mod_perl docs.
  • Comment on Re: mod_perl was hosed by a bind variable

Replies are listed 'Best First'.
Re: Re: mod_perl was hosed by a bind variable
by dws (Chancellor) on Jan 29, 2004 at 22:40 UTC
    The fastest way to use DBI is with prepare_cached() and bind variables. This is in the mod_perl docs.

    Is this true even when the underlying database (e.g., MySQL, in this case), doesn't support prepared queries?

      Yes, because it skips a bunch of object creation and stuff on the client side.
      A reply falls below the community's threshold of quality. You may see it by logging in.
Re^2: mod_perl was hosed by a bind variable (tangent)
by tye (Sage) on Jan 30, 2004 at 16:24 UTC

    Since perrin keeps pressing this point, I wanted to mention that, though perrin's advice is reasonable, this first conclusion ("You must have been preparing the query every time then") doesn't make any sense in the situation being discussed.

    If someone complains that using a placeholder makes their code much slower, then caching the query cannot be part of the explanation, since the "fast" case makes it impossible to cache the query so caching could only explain it if caching made things slower.

    - tye        

      If someone complains that using a placeholder makes their code much slower, then caching the query cannot be part of the explanation

      That was my point, actually: that if not using placeholders appeared to make it faster, then he must not have been caching the query, which means he was missing out on a large part of the speed offered by placeholders.

A reply falls below the community's threshold of quality. You may see it by logging in.