On Wed, Dec 14, 2011 at 5:49 PM, Eric Evans <eev...@acunu.com> wrote: > Thanks to the hard work of Rick Shaw, prepared statements > (https://issues.apache.org/jira/browse/CASSANDRA-2475) has been > committed to trunk. However, before you use it, be advised that the > API might be changing in the next few days. > > If it does change, it should be limited to moving the bind parameters > from string to bytes, (pending a comparison of the performance). I'll > send another email with the changes, if any, after the API is expected > to be stable.
To follow up on this, and to draw the attention of the folks on client-dev@ who have some stake in this: There was some discussion in #2475, and later in #3634, about whether clients would supply string, or binary bind arguments for a prepared statement. I encourage anyone that is interesting to read through the tickets, but the short version is that since Cassandra uses binary values internally, having the clients serialize types to binary would be more performant than having Cassandra do it, while string arguments result in simpler, easier to code drivers. Since it boils down to a question of trading one thing for another, we agreed to do some performance testing so that we could at least put some real numbers to it. That performance testing is complete. Again, I encourage you to check out the results[2] yourself, but they could be summarized by saying that most operations (reads, counter increments, inserts with an indexed columns) are equivalent. It mostly boils down to standard inserts which are 10% faster when using binary arguments than for string arguments. It's worth noting (because either way it's awesome :)), that even with string arguments, writes using prepared statements are 5% faster than RPC (16% with binary arguments). We need to drive a stake in the ground Real Soon Now, but since this issue directly affects client maintainers, I'd be interested in hearing what they had to say about this (either here, or in the ticket). Cheers, [1]: https://issues.apache.org/jira/browse/CASSANDRA-2475 [2]: https://issues.apache.org/jira/browse/CASSANDRA-3634 -- Eric Evans Acunu | http://www.acunu.com | @acunu