Outdated Version

You are viewing an older version of this section. View current production version.

Using Prepared Statements min read


Info

If you are running SingleStore Managed Service, use the admin endpoint to run the commands discussed in this topic.

MemSQL version 6.7 and later supports prepared statements; however, server-side prepared statements are not supported when using Audit Logging. If Audit Logging is enabled, attempting to run server-side prepared statements will return the error Feature 'Audit logging with binary protocol' is not supported by SingleStore DB.

If you are using an older version of SingleStore DB, or using SingleStore DB with Audit Logging enabled, server-side prepared statements are not supported. Instead, many client drivers support a configuration option to allow client-side prepared statements. This configuration option may also be referred to as client-side prepared statement emulation or parameter interpolation. You can use the same code in your application, but just change a flag in the client driver configuration. For example:

In many other databases, server-side prepared statements provide performance advantages, but SingleStore DB already compiles and caches query plans internally, so SingleStore DB does not need server-side prepared statements to get most of those performance advantages.