[RESOLVED] Does a prepared statement get cached?
Hey everyone, quick question. Says the PHP manual,
$stmt = $mysqli->prepare("SELECT * FROM test WHERE id = ?");
this will make the database prepare itself to run this query; find out the best way to run it, how to structure the results, etc. If I use this same $stmt later, then all that work is still saved, yay!
My question, however, is what if I don't use the $stmt variable? If I call $mysql->prepare with the same exact string, will it see that its the same as before, and use the earlier preparations? Or do I absolutely have to save the $stmt variable and use it again, to get the nice speed boost?
As far as I know, a new "prepare" would be handled separately and without knowledge of the prior query. I cannot claim to be 100% positive about that, but pretty darned close.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Okay cool, thanks for the quick response.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread