How do I calculate my average record size?

In Typesense, only fields you'll be using for searching, filtering, faceting, sorting or grouping on - we call these "indexed" fields - count towards memory usage.

You can still send additional "unindexed" fields in your documents and Typesense will store these on disk and return them if a document is a hit for a search query. These unindexed fields do not count towards RAM usage.

So when you estimate RAM usage, you want to only include the values of these indexed fields.

For eg, let's say you have a JSON document like this:

{

"album_name": "John Denver Rare and Unreleased",

"country": "US",

"genres": ["country"],

"id": "31401733",

"primary_artist_name": "John Denver",

"release_date": 1104537600,

"release_decade": "2010s",

"release_group_types": [

"Album"

],

"title": "Annie's Song",

"track_id": "58ac90d0-d6fe-4395-9e65-f714ae4c23c0",

"urls": []

}

And you only want to search on album_name and primary_artist_name and you want to filter on genres and release_date .

In this case, you want to take just the values of the fields as the size of one record.

Let's say on average an album name can have 100 characters (that's 100 bytes), primary artist name can be 50 characters (that's 50 bytes), genres can be 50 characters (that's 50 bytes) and release date is an integer (that's 4 bytes).

So our average record size is 100 + 50 + 50 + 4 = 204 Bytes = 0.204 KB.


So even though your documents have other fields like track_id , urls , release_decade , etc since you're not searching on them and potentially only using them for display purposes, they don't count towards RAM usage.


The length of field names also does not affect RAM usage, since field names are not repeated in the index.

Still need help? Contact Us Contact Us