Delete prepared statements

n1ql

#1

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!


#2

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


#3

@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.


#4

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.


#5

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


#6

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