Delete prepared statements

According to the docs, prepared statements are stored in the server until it’s restarted. Is there anyway to delete them if they are not needed anymore?

I’m using the Java SDK.
Thanks!

I don’t think you should worry about this. The server will eventually clean out unused prepared statements if needed.

1 Like

@geraldss Thanks for your prompt answer! In case where I execute a prepared statement that has been deleted by the server, then the sdk essentially tries to prepare it again? And if I’m doing a manual query (say, via the REST api), then I have to also handle it myself?

Thanks again.

Yes, the SDKs have the ability to provide prepared statements that are not available on a given server node.

In the N1QL REST API, if you issue a PREPARE command, you will receive a full prepared statement that you can maintain in your client, in addition to the prepared statement being on the server.

@geraldss Thanks!!! You’re helpful as always.

1 Like

In addition to that - Watson will allow you to delete prepared statements.

2 Likes