Unexplained higher CPU when using "union all"

Hi Folks,
We are using MyRocks as key value store. To make it easy to port HBase use cases, our PK has rowkey, column family name, column name and version.

When implementing getMulti(), which retrieves keys from multiple shards (each shard is a separate MyRocks table) on the same host, we used union all, where each select inside union all retrieves keys from one shard.

The above seems like a basic use case of “union all”, but we were really surprised that if we just use N get() calls (where each get() call gets only one key), CPU usage is noticeably lower rather if we use getMulti() calls (where each getMulti() call retrieves N keys).

Wondering if any known major inefficiencies in “union all” implementation?

Thanks,
Vamsi

1 Like