Question

Using the new native driver, CQL queries can either be constructed using strings or via the QueryBuilder class.

I would like to know how the driver handles statements constructed using QueryBuilder. Does it transmit to the coordinator node a representation of the parsed query or does it simply transmit the constructed query as a string?

The reason I ask is because we specify our queries in a structured format. It is easier to transform this format into text-based CQL than use the QueryBuilder, but we would do so if it was worth it.

In essence, my question boils down to: where is the CQL parsed, in the driver or on the node?

Était-ce utile?

La solution

CQL is all handled on Cassandra nodes. This applies to all DataStax drivers.

As regards to advantages, I'd say it's a matter of preference: handling strings or having a fluent API (with auto-completion, compile time checks, etc.)

Autres conseils

If I remember correctly, the QueryBuilder will just create your CQL query as a String and send it to C*, therefore there is no real performance gain or advantage using it but you will make sure that your CQL query has the correct syntax. If you are looking for performance then you should try to use prepared statement instead, the gain is relatively small but again it is going depend from your use case.

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