# Record size limit

**URL:** https://forums.foundationdb.org/t/record-size-limit/3811
**Category:** Using FoundationDB
**Created:** [February 17, 2023, 11:40am UTC](https://forums.foundationdb.org/t/record-size-limit/3811 "2023-02-17T11:40:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![slowfranklin](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/slowfranklin/32/1490_2.png) [@slowfranklin](https://forums.foundationdb.org/u/slowfranklin)
#### Post date: [February 17, 2023, 11:40am UTC](https://forums.foundationdb.org/t/record-size-limit/3811/1 "2023-02-17T11:40:55Z")

</div>

I’m getting record size limit exceptions

`fdb.impl.FDBError: b'Value length exceeds limit' (2103)`

although the record is only 58k. I’m calling from C via C-Python bindings and the C PyBytes object tells me PyBytes\_GET\_SIZE(value) is 58378.

What’s going on? I thought the fdb limit is 100k?

Any pointers much appreciated! 🙂

Thanks!  
-slow

---

<div class="post-metadata">

### Author: ![slowfranklin](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/slowfranklin/32/1490_2.png) [@slowfranklin](https://forums.foundationdb.org/u/slowfranklin)
#### Post date: [February 17, 2023, 1:00pm UTC](https://forums.foundationdb.org/t/record-size-limit/3811/2 "2023-02-17T13:00:30Z")

</div>

Nevermind, got it… the value contains 41630 0x00 and 1781 0xFF which makes 101789 total. Ouch!

Any way to store binary values as length encoded blobs instead of the current Byte String the needs to escape 0x00 (and 0xff)?

---

<div class="post-metadata">

### Author: ![MMcM](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@MMcM](https://forums.foundationdb.org/u/MMcM)
#### Post date: [February 17, 2023, 10:33pm UTC](https://forums.foundationdb.org/t/record-size-limit/3811/3 "2023-02-17T22:33:32Z")

</div>

It sounds like you are putting the byte string into a tuple and then packing that tuple to get the key-value pair that you store. Is that right? Is that because it is part of some larger data structure? If not, you could just put the bytes themselves into the value, with no further encoding at all. If so, then perhaps you need a different serialization format in place of tuples.

Tuples have nice ordering properties that make them a good choice for the key, but that aren’t needed for the value.

---

<div class="post-metadata">

### Author: ![slowfranklin](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/slowfranklin/32/1490_2.png) [@slowfranklin](https://forums.foundationdb.org/u/slowfranklin)
#### Post date: [February 19, 2023, 3:11pm UTC](https://forums.foundationdb.org/t/record-size-limit/3811/4 "2023-02-19T15:11:21Z")

</div>

Thanks! That’s it. I realized that sometimes after posting this. Guess I originally thought I had to pack the record, as when fetching and returning that object is of type fdb.impl.value (iirc) which I didn’t handle correctly in my C program that used fdb via C Python bindings → fdb Python API.
