When the netty ByteBuf is not backed by a byte array.
N1qlQueryExecutor#executeQuery is allocating the byte array twice.
- the first time in TranscoderUtils#byteBufToByteArray
- the second with Arrays#copyOfRange
a specialized version of TranscoderUtils#byteBufToByteArray should be created that will only call Arrays#copyOfRange if the ByteBuf is backed by a byte array.
A hackish implementation tested in our environment reduced our n1ql memory allocation by 50% !