# Impact of tag length in performance

**URL:** <https://community.influxdata.com/t/impact-of-tag-length-in-performance/6317>\
**Category:** Telegraf\
**Tags:** influxdb\
**Created:** [August 21, 2018, 5:43pm UTC](https://community.influxdata.com/t/impact-of-tag-length-in-performance/6317 "2018-08-21T17:43:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmorante](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@jmorante](https://community.influxdata.com/u/jmorante)\
**Post date:** [August 21, 2018, 5:43pm UTC](https://community.influxdata.com/t/impact-of-tag-length-in-performance/6317/1 "2018-08-21T17:43:36Z")

</div>

Hi all.

We need to store data in influx with very long string tag, I’d like to know how is the size of the tag impacting in the performance of queries and growth of DB size.

For instance, let’s imagine I want to store a metric with the following tags:

customerid=121  
monitorid=LKRWE30240934JKJEDF093SJDFSDKJLF93049234JSDJFKJSDF923RFJSDJFL09R4398JRSLFKJSDF4908435JFJSLKFJ904JFS

And then some values like:  
exectime=12  
status=6  
cpu=70

So, my concerns are:

- Are the tags stored multiple times (i.e. one per sample) or just once?
- Is the size of the tag impacting in the query? So, for instance quering by the customerid will work better than for monitorid? Or is the tag size not impacting at all?

Thanks!

---

<div class="post-metadata">

**Author:** ![katy](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/katy/32/855_2.png) [@katy](https://community.influxdata.com/u/katy)\
**Post date:** [August 27, 2018, 10:23pm UTC](https://community.influxdata.com/t/impact-of-tag-length-in-performance/6317/2 "2018-08-27T22:23:24Z")

</div>

Hi!

A tag is only stored once. Database names, [measurements](https://docs.influxdata.com/influxdb/v1.6/concepts/glossary/#measurement), [tag keys](https://docs.influxdata.com/influxdb/v1.6/concepts/glossary/#tag-key), [field keys](https://docs.influxdata.com/influxdb/v1.6/concepts/glossary/#field-key), and [tag values](https://docs.influxdata.com/influxdb/v1.6/concepts/glossary/#tag-value) are stored only once and always as strings. Only [field values](https://docs.influxdata.com/influxdb/v1.6/concepts/glossary/#field-value) and [timestamps](https://docs.influxdata.com/influxdb/v1.6/concepts/glossary/#timestamp) are stored per-point.

Non-string values require approximately three bytes. String values require variable space as determined by string compression.

While the strings may affect overhead, overall they will have much less impact than other big factors like cardinality.

---

<div class="post-metadata">

**Author:** ![mikeurbach](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@mikeurbach](https://community.influxdata.com/u/mikeurbach)\
**Post date:** [October 14, 2021, 3:43pm UTC](https://community.influxdata.com/t/impact-of-tag-length-in-performance/6317/3 "2021-10-14T15:43:59Z")

</div>

This is great information, is it documented somewhere?
