Michal
Michal

Reputation: 2228

Batch to different tables with same partition key

Unlogged batches, as opposed to separte inserts, improve performance when inserts stay within the same partition.

What if tables t1 and t2 share exaclty the same partition key - does the same rule apply when a batch is a mix of t1 and t2 inserts?

This means respective t1 and t2 partitions are stored on the same node - link

Upvotes: 0

Views: 154

Answers (1)

Chris Lohfink
Chris Lohfink

Reputation: 16400

If the partition key is the same it would route to the same replicas so yes if sent to right coordinator it wont have the extra network hops. But it will still need to apply them separately to different memtables.

Batching is funny though and theres limits to where it will hurt performance even if all in same partition, it depends massively on data model. If batching makes huge differences in your app its more likely your throughput is dictated too much by latencies (littles law) in which case making the queries/handling asynchronous can help as well and will be give predictable results.

Upvotes: 2

Related Questions