MySQL Forums
Forum List  »  Perl

Perl bind performance versus no bind
Posted by: Shayne Paddock
Date: February 25, 2005 01:44PM

I'm seeing significant performance loss when I bind variables to queries as opposed to just building a the query as a dynamic string and executing it.

I was using commands like this:
$sqlStatement->bind_param(1,$my_variable);

The query is going against a table with 1.6 million rows and it took about 5 seconds to run.

After I changed the query to something like:
$cmd = "select count(*) from mytable where id = " . ${my_variable}

The query time got cut to under 1 second.

Does the bind process just take that much more time? I would have thought binding the variables was the "proper" way of doing it. We are running mysql 4.1.9 with the latest DBD and DBI packages.

Would turning on the query cache solve this?


Kindest regards,
Shayne

Options: ReplyQuote


Subject
Written By
Posted
Perl bind performance versus no bind
February 25, 2005 01:44PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.