MySQL Forums
Forum List  »  MyISAM

Re: large tables, large keycaches
Posted by: Jay Pipes
Date: July 27, 2005 03:52PM

Mike Connell wrote:
> Could you, Jay, or someone else elaborate on how
> Prepared statements are beneficial in MySQL. I'm familiar with how
> this is beneficial in Oracle, but was not aware that MySQL had machinery to also
> take advantage.

Well, the general principle is similar to Oracle, I believe. The C API's prepared statement calls allow for faster execution of repeated SQL calls. It does this by initiating the SQL statement in the client, and passing this statement to the server, which "prepares" the statement for repeated execution by parsing the statement, and setting up placeholders for variables to be filled in. After the statement has been prepared, the client and server communicate to each other in a binary format, and only send the placeholder parameters back and forth between each other, instead of the whole query. This speeds things up considerably on repeated execution calls because the statement does not need to be parsed over and over; instead the placeholders are simply filled in with the next set of parameters as the client issues repeated calls against the server's prepared statement. It can also serve to reduce network traffic since the communication between the client and server is a) binary, and b) not sending as much info (only the new params...)

Unfortunately, I'm not a Java guy, and don't really know a whole lot about Connector/J and its abilities. Some preliminary research returned some inconsistent findings. In one section of the manual, it says that Connector/J was a candidate for prepared statements, but I could find no support for prepared statements in the Connector/J docs. The mysqli PHP library contains prepared statement execution for PHP, which it sounds like would be ideal for your front loader written in PHP. Perhaps Ingo might know about the Java implementation, or you might consider posting a question on the Connector/J forum.

Hope this helps a bit :)

Jay Pipes
Community Relations Manager, North America, MySQL Inc.

Got Cluster? http://www.mysql.com/cluster
Personal: http://jpipes.com

Options: ReplyQuote


Subject
Views
Written By
Posted
9178
July 25, 2005 09:12PM
3187
July 26, 2005 08:43AM
3131
July 26, 2005 10:37AM
2996
July 26, 2005 11:49AM
2722
July 26, 2005 02:27PM
2798
July 26, 2005 04:36PM
2475
July 27, 2005 10:49AM
Re: large tables, large keycaches
2498
July 27, 2005 03:52PM
2517
August 02, 2005 08:04PM
2615
July 26, 2005 10:51AM
2466
July 27, 2005 07:48AM
2550
July 28, 2005 01:08PM


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.