MySQL Connector/NET Developer Guide

5.5 Using the Connector/NET with Prepared Statements

Use of prepared statements can provide significant performance improvements on queries that are executed more than once.

Note

Prepared statement support is available with MySQL 4.1 and higher.

Prepared execution is faster than direct execution for statements executed more than once, primarily because the query is parsed only once. In the case of direct execution, the query is parsed every time it is executed. Prepared execution also can provide a reduction of network traffic because for each execution of the prepared statement, it is necessary only to send the data for the parameters.

Another advantage of prepared statements is that, with server-side prepared statements enabled, it uses a binary protocol that makes data transfer between client and server more efficient.

Note

Enable server-side prepapared statements (they are disabled by default) by passing in "IgnorePrepare=false" to your connection string.