Hello, I'm trying to determine the proper way to use PreparedStatements using the datastax CQL Java driver;
so the API is Session session = ... PreparedStatement ps = session.prepare("INSERT INTO <table-name> (column, ...) VALUES (?, ...)") BoundStatement bs = new BoundStatement(ps); //bind variables session.execute(bs) 1. My question is should I only instantiate the PreparedStatement once and reuse *the same instance* every time I want to execute an INSERT? Is that necessary to get the performance benefits of using PreparedStatements? 2. Or does session.prepare("INSERT INTO <table-name> (column, ...) VALUES (?, ...)") return the "same logical" PreparedStatement each time (it need not necessarily be the identical (as in ==) instance), and you still get the same performance benefits? Note: this is how you used jdbc.PreparedStatements If the answer is #1, then that means PreparedStatements are effectively singletons and need to be multi-thread-safe and the app is responsible for dealing with lifecycle issues presuming that the original Session dies or whatever I've looked at the datastax API datastax API <http://www.datastax.com/drivers/java/1.0/apidocs/> , chatted on IRC, and no answer. This seems to me as a pretty fundamental question -- View this message in context: http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Proper-Use-of-PreparedStatements-in-DataStax-driver-tp7590793.html Sent from the cassandra-u...@incubator.apache.org mailing list archive at Nabble.com.