public static Integer sizeOfInnerBatchStatementInBytes ( BatchableStatement statement , ProtocolVersion protocolVersion , CodecRegistry codecRegistry ) { int size = 0 ; size += PrimitiveSizes . BYTE ; // for each inner statement, there is one byte for the "kind": prepared or string if ( statement instanceof SimpleStatement ) { size += PrimitiveSizes . sizeOfLongString ( ( ( SimpleStatement ) statement ) . getQuery ( ) ) ; size += sizeOfSimpleStatementValues ( ( ( SimpleStatement ) statement ) , protocolVersion , codecRegistry ) ; } else if ( statement instanceof BoundStatement ) { size += PrimitiveSizes . sizeOfShortBytes ( ( ( BoundStatement ) statement ) . getPreparedStatement ( ) . getId ( ) . array ( ) ) ; size += sizeOfBoundStatementValues ( ( ( BoundStatement ) statement ) ) ; } return size ; }
The size of a statement inside a batch query is different from the size of a complete Statement . The inner batch statements only include the query or prepared ID and the values of the statement .