I’ve noticed the “Result size” displayed on the Query tab in the admin console for a result containing a single document is much larger than a query returning the ENCODED_SIZE for that same document.
So, SELECT * FROM bucket USE KEYS ‘docId’ has a Result size of, for example, 1,000
while SELECT ENCODED_SIZE(bucket) FROM bucket USE KEYS ‘docId’ returns a value of 400 (or some value substantially less than 1000)
My question is, if this document is retrieved from couchbase through the couchbase api (8093 port by default) or through an sdk, which of these is the size of the traffic being sent over the network as the response, and why is there such a large discrepancy?
resultSize includes whitespace. It is the size of the network transfer.
So in the Java SDK, for example, if I just do bucket.get(docId), in this case, the response size is 1,000ish rather than 400ish?
You can set pretty = false on the query options in the SDK to avoid the whitespace!
Good to know. Thanks for the quick responses!
Also note that you can disable metrics, as the N1QL response includes metrics as tracked by cbq-engine in the middle. That will bring the network usage even closer yet, though the KV interface uses less space for this simple case.
Out of curiosity, is it possible to return the unformatted json in the Admin UI?
The Admin UI does not currently support unformatted JSON. Would that be useful?
I was mainly just curious. I don’t immediately see any use for it.
So the encoded size is the size that counts toward the 20mb document size limit, correct?
Yes, the resultSize is not directly related to the 20MB document limit.