Question

When we create a PreparedStatement object is it cached on the server side? How it is different comparing to PreparedStatement in Oracle driver? If prepared statement is reused, what data is sent to Cassandra server, param values only?

From what I understand, one Session object in java driver holds multiple connections to multiple nodes in cluster. If we reuse the same prepared statement in our application in multiple threads, will make us using only one connection to one Cassandra? I guess preparing statement is done on one connection only... What happens when routing key is updated by each execute call?

What are benefits of using prepared statements?

Thank you

Était-ce utile?

La solution

Yes, only the statement ID and parameters need to be sent after preparing the statement.

The driver tracks statement IDs for each server in its connection pool; it's transparent to your application.

The benefit is improved performance from not having to re-compile the statement for each query.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top