[
https://issues.apache.org/jira/browse/CASSANDRA-2475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13057288#comment-13057288
]
Rick Shaw commented on CASSANDRA-2475:
--------------------------------------
In order to see the performance value (as opposed to convenience) of the
concept of Prepared Statements in CQL, the design needs to change to have ANTLR
parse the strings into a token-stream that can be reused as opposed to
executing in line with recursive decent. It is the "reusable" token stream that
provides the performance leverage.
I suggest that these token streams could be small enough that they could be the
returned value from the "Prepare" call and relieve the server side from the
maintenance and accounting hassle of keeping track of them. The client would
squirrel them away for reuse, whenever. Possibly the token stream could be
designed to be reused across processes; just a resource in a proprietary byte
stream format? The design of the JDBC driver assumes that Prepared Statements
are pool-able on the client side along with connections. I am aware that it
could be the handle that is pooled, but that would have a potentially shorter
lifetime.
Even simple statements would be parsed down to the stream of tokens; It would
just be executed immediately and then tossed as opposed to returning the to the
caller.
A roadblock may be the fact that batch is handled directly in the CQL syntax
right now. This is fine using the current approach, but will be very messy with
a saved set of tokens that are reused and the parameter substitution that must
go on server side. I believe that is why the JDBC driver treats batch as
another concept that can take sets of prepared statements and their associated
parameters as a list rather than making it just part of the SQL syntax.
> Prepared statements
> -------------------
>
> Key: CASSANDRA-2475
> URL: https://issues.apache.org/jira/browse/CASSANDRA-2475
> Project: Cassandra
> Issue Type: Sub-task
> Components: API, Core
> Reporter: Eric Evans
> Labels: cql
> Fix For: 1.0
>
>
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira