# How to insert bulk data (Key-Value pair) at once in C programming

**URL:** <https://forums.foundationdb.org/t/how-to-insert-bulk-data-key-value-pair-at-once-in-c-programming/1293>\
**Category:** Using FoundationDB\
**Tags:** fdbsummit\
**Created:** [April 10, 2019, 10:28am UTC](https://forums.foundationdb.org/t/how-to-insert-bulk-data-key-value-pair-at-once-in-c-programming/1293 "2019-04-10T10:28:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sakthivelpvs](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@sakthivelpvs](https://forums.foundationdb.org/u/sakthivelpvs)\
**Post date:** [April 10, 2019, 10:28am UTC](https://forums.foundationdb.org/t/how-to-insert-bulk-data-key-value-pair-at-once-in-c-programming/1293/1 "2019-04-10T10:28:44Z")

</div>

Hi, I have created a client which inserting kay -value pairs one by one. Using following code,

```
fdb_transaction_set(tr, key1, (int)strlen(key1), val1, (int)strlen(val1));
fdb_transaction_set(tr, key2, (int)strlen(key2), val2, (int)strlen(val2));
FDBFuture *commitFuture = fdb_transaction_commit(tr);
fdb_future_block_until_ready(commitFuture);

```

Is there way to insert bulk data at once, instead of inserting one by one using C programming.

---

<div class="post-metadata">

**Author:** ![gaurav](https://avatars.discourse-cdn.com/v4/letter/g/b487fb/32.png) [@gaurav](https://forums.foundationdb.org/u/gaurav)\
**Post date:** [April 10, 2019, 12:23pm UTC](https://forums.foundationdb.org/t/how-to-insert-bulk-data-key-value-pair-at-once-in-c-programming/1293/2 "2019-04-10T12:23:20Z")

</div>

Are you concerned about overheads of individual set operations in the transaction, or is it something different?

In the above code, client keeps all key-value pairs in memory and sends them together in a single call to server when transaction commits.

---

<div class="post-metadata">

**Author:** ![alexmiller](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/alexmiller/32/326_2.png) [@alexmiller](https://forums.foundationdb.org/u/alexmiller)\
**Post date:** [April 11, 2019, 12:55am UTC](https://forums.foundationdb.org/t/how-to-insert-bulk-data-key-value-pair-at-once-in-c-programming/1293/3 "2019-04-11T00:55:07Z")

</div>

There is no special API for bulk loading of data nor a more efficient way to write data than `set()` and `commit()`, but [Best practices for bulk load](https://forums.foundationdb.org/t/best-practices-for-bulk-load/422) has some advice on how to write a bulk loading client.
