You are viewing an older version of this section. View current production version.
MemSQL does not support server-side prepared statements. However, many client drivers support client-side prepared statements which work with MemSQL.
There are two related but different concepts of prepared statements: the prepared statements API exposed by the client driver (client-side prepared statements), and the prepared statements client-server protocol (server-side prepared statements). In general, it is possible to use both, or to use client-side prepared statements without server-side prepared statements. In MemSQL, only the latter is supported.
In many other databases, server-side prepared statements provide performance advantages, but MemSQL already compiles and caches query plans internally, so MemSQL does not need server-side prepared statements to get most of those performance advantages.
Many drivers support client-side prepared statements without server-side prepared statements, i.e. using the prepared statements API in your application while sending non-prepared statements to the server. This may also be referred to as client-side prepared statement emulation or parameter interpolation. This allows you to use the same code in your application, but just change a flag in the client driver configuration. For example:
- in the MySQL Connector/J (JDBC) driver, configuring
useServerPrepStmts=false, which is the default configuration (http://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html).
- in MariaDB Connector/J, configuring
- in ODBC, configuring
- in the Go MySQL driver, configuring
- in PHP PDO, configuring
MemSQL has experimental support for server-side prepared statements, which is available as a prototype and is not supported in production. It is disabled by default, and may be enabled by setting