# How to find the size of single row in crate db

**URL:** <https://community.cratedb.com/t/how-to-find-the-size-of-single-row-in-crate-db/721>\
**Category:** CrateDB\
**Created:** [June 12, 2021, 9:21am UTC](https://community.cratedb.com/t/how-to-find-the-size-of-single-row-in-crate-db/721 "2021-06-12T09:21:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![testjob\_tyu](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/testjob_tyu/32/327_2.png) [@testjob\_tyu](https://community.cratedb.com/u/testjob_tyu)\
**Post date:** [June 12, 2021, 9:21am UTC](https://community.cratedb.com/t/how-to-find-the-size-of-single-row-in-crate-db/721/1 "2021-06-12T09:21:29Z")

</div>

How to find the size of single row i entered int crate DB. Below is my schema.  
Schema  
Name Type  
name1 TEXT  
name2 TEXT  
name3 TEXT  
reading1 DOUBLE  
reading2 DOUBLE

When i enter a value like  
(  
“abcdefg”  
“lmnopk”  
“aksjuiopuuu”  
1231231231,  
1314124214  
)  
How to know the each text consumed bytes (size ) and entire row size in crate db ???

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [June 12, 2021, 9:31am UTC](https://community.cratedb.com/t/how-to-find-the-size-of-single-row-in-crate-db/721/2 "2021-06-12T09:31:26Z")

</div>

> How to know the each text consumed bytes (size ) and entire row size in crate db ???

I’d say this isn’t really possible with CrateDB.  
May I ask what you want to achieve?

The `sys.shards` table has the information for how much disk space is actually used for a shard. Keep in mind that this might go down, with new lucene segments being created.

---

<div class="post-metadata">

**Author:** ![testjob\_tyu](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/testjob_tyu/32/327_2.png) [@testjob\_tyu](https://community.cratedb.com/u/testjob_tyu)\
**Post date:** [June 12, 2021, 10:24am UTC](https://community.cratedb.com/t/how-to-find-the-size-of-single-row-in-crate-db/721/3 "2021-06-12T10:24:03Z")

</div>

I just want to know a single row entry take how much space?.  
So that i want to configure the crate yaml.

```auto
        env:
          # This is variable is detected by CrateDB.
        - name: CRATE_HEAP_SIZE
          value: "256m"
 volumeClaimTemplates:
    # Use persistent storage.
    - metadata:
        name: data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 1Gi

```

This is the yaml info.

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [June 12, 2021, 10:31am UTC](https://community.cratedb.com/t/how-to-find-the-size-of-single-row-in-crate-db/721/4 "2021-06-12T10:31:42Z")

</div>

you can calculated an average required disk size like this:

```sql
SELECT 
  schema_name,
  table_name,
  SUM(num_docs),
  SUM(size),
  SUM(size) / SUM(num_docs)::DOUBLE as avg_size_in_bytes
FROM sys.shards
where PRIMARY
GROUP BY 1,2

```

---

<div class="post-metadata">

**Author:** ![testjob\_tyu](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/testjob_tyu/32/327_2.png) [@testjob\_tyu](https://community.cratedb.com/u/testjob_tyu)\
**Post date:** [June 12, 2021, 10:36am UTC](https://community.cratedb.com/t/how-to-find-the-size-of-single-row-in-crate-db/721/5 "2021-06-12T10:36:14Z")

</div>

i am inserting 300 records in 5 minute.  
that mean in an year 300 \* 12 \* 24 \* 365=31536000.

How do i calculate the data entry ?

> above query give

```auto
> schema_name	table_name sum(num_docs) sum(size)
> doc testtable 84292 29812764

```

based on that for single entry 29812764 / 84292 = 353.68438286 byte

So for 1 year 11.163744 GB required?

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [June 12, 2021, 11:09am UTC](https://community.cratedb.com/t/how-to-find-the-size-of-single-row-in-crate-db/721/6 "2021-06-12T11:09:52Z")

</div>

> [@testjob\_tyu](#):
>
> 31536000

this would be a first estimation, probably good to try testing with larger data sets.
