# Batch performance considerations, when grouping queries on the client side

**URL:** <https://forum.scylladb.com/t/batch-performance-considerations-when-grouping-queries-on-the-client-side/2076>\
**Category:** ScyllaDB\
**Tags:** data-model, performance, batch\
**Created:** [May 27, 2024, 5:51am UTC](https://forum.scylladb.com/t/batch-performance-considerations-when-grouping-queries-on-the-client-side/2076 "2024-05-27T05:51:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guy](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/guy/32/9_2.png) [@Guy](https://forum.scylladb.com/u/Guy)\
**Post date:** [May 27, 2024, 5:51am UTC](https://forum.scylladb.com/t/batch-performance-considerations-when-grouping-queries-on-the-client-side/2076/1 "2024-05-27T05:51:57Z")

</div>

> [@](#):
>
> [**Originally from the User Slack**](https://scylladb-users.slack.com/)
> 
> ![Artem_Golovko](https://us1.discourse-cdn.com/flex016/uploads/scylladb/original/1X/657780876ac3a9aa8c606bb8004e7a27199a1fd7.png) **@Artem\_Golovko:** Hello everyone. I would like to ask about batch performance consideration. Are there any performance improvements from grouping several INSERT statements with the same PK and same table together with UNLOGGED batch on the client side?
> 
> ![dor](https://us1.discourse-cdn.com/flex016/uploads/scylladb/original/1X/27b698a3e588f84cb82a722e458d31c997a48bed.jpeg) **@dor:** Probably, since it will go to the same replicas anyway. Write performance in general is very good, not sure you need to over think it
> 
> ![Artem_Golovko](https://us1.discourse-cdn.com/flex016/uploads/scylladb/original/1X/657780876ac3a9aa8c606bb8004e7a27199a1fd7.png) **@Artem\_Golovko:** @dor if you will have the following structure
> 
> table1: ((key), f1, f2), value  
> table2: ((key), f2, f1), value
> 
> so absolutely the same tables, but first one allow you to get value based on the f1, while the second one allow you to get value based on the f2. And you need 2 inserts for every record.
> 
> My idea was to merge these two tables into the one table:  
> common\_table: ((key), type, f1, f2), value
> 
> now I can use a batch insert:  
> BEGIN BATCH  
> INSERT key, false, f1, f2, value  
> INSERT key, true, f2, f1, value  
> END BATCH
> 
> Does it make sense?
> 
> ![dor](https://us1.discourse-cdn.com/flex016/uploads/scylladb/original/1X/27b698a3e588f84cb82a722e458d31c997a48bed.jpeg) **@dor:** Oh, two separate tables, that wouldn’t improve performance. Each table has its own set of sstables ,caches, etc
