Speed of Bulk operation vs Select

The documentation of the Go SDK says:

func (b *Bucket) Do(ops BulkOp) error

Do execute one or more BulkOp items in parallel.

Does that mean issuing n requests to the server, n being the size of the slice?

Because then this could be faster, a single trip to the database

SELECT *, META().id FROM travel-sample where meta().id in [...list of ids like in the []Bulkop]

On the other hand, this page:

says:

The BulkOp type has a method called “Do” which actually performs the pipelining of requests in a batch operation on the cluster.

Which would indicate that a single request is issued.

What is actually the case? What is best for performance?

Hey @piero,

Our KV operations will vastly outperform N1QL operations in the majority of cases. In this particular case, the bulk operation method enables us to dispatch a number of operations without blocking, and then receive their results together later. It is primarily a protocol optimization and effectively behaves the same as if you dispatched a single command on the wire to perform multiple operations. For batches of work that need to be performed, the bulk operations API will easily outperform singular operations being performed.

Cheers, Brett

1 Like