On 2013-04-19 13:57, Stuart Broad wrote:
Hi,

I am using Cassandra.Client
prepare_cql3_query/execute_prepared_cql3_query to create and run some
prepared statements.  It is working well but I am unclear as to how long
the server side 'caches' the prepared statements.  Should a prepared
statement be prepared for every new Cassandra.Client?  Based on my
limited testing it seems like I can create some prepared statements in
one Cassandra.Client and use in another but I am not sure how
reliable/lasting this is i.e.  If I called the prepared statement again
the next day would it still exist?  What about if cassandra was re-started?

I don't know the answer and I have the same question. But have a look at this discussion, dating from September 2012.

https://issues.apache.org/jira/browse/CASSANDRA-4449

Apparently prepared statements are shared among threads (they were per-connection previously), they don't survive server restarts, apparently there's an LRU mechanism, and apparently you get a special exception if the prepared statement "disappeared" so you can prepare it again.

Regards,
Sorin


_Background:_
I am creating prepared statements for batch updates of pre-defined
lengths (e.g. 10000, 1000, 500, 250, 50, 10, 1) and wanted to know if
these could just be set up once.  We felt that using the prepared
statements was easier than escaping values within a CQL statement and
probably more performant.

Thanks in advance for your help.

Regards,

Stuart

p.s. I am relatively new to cassandra.

Reply via email to