# Multi tenant structure

**URL:** <https://community.influxdata.com/t/multi-tenant-structure/28660>\
**Category:** InfluxDB 2\
**Tags:** influxdb, flux\
**Created:** [February 16, 2023, 10:24pm UTC](https://community.influxdata.com/t/multi-tenant-structure/28660 "2023-02-16T22:24:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thopewell](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@thopewell](https://community.influxdata.com/u/thopewell)\
**Post date:** [February 16, 2023, 10:24pm UTC](https://community.influxdata.com/t/multi-tenant-structure/28660/1 "2023-02-16T22:24:30Z")

</div>

Hello @Anaisdg,

I had a quick question regarding the optimum structure for multi tenancy.  
A similar question was asked some time ago:

> [@Correct Multi Tenant Structure](https://community.influxdata.com/t/correct-multi-tenant-structure/3745):
>
> I have a question regarding the correct setup for a multi tenant IOT sensor application. Basically, I have a customer id with each customer having 1 to potentially thousands of sensors deployed each with a sensor id. The sensors each generate many records each day. So any thoughts on which of the setups below would be optimal. There are very few queries that extend across multiple customers and they do not have to be particularly performant. There are many queries that extend across multipl…

If the schema in a measurement is identical (same tags, field key names) is it better to have all the data in a single measurement (per schema) with tags to idenfity the customers:

```auto
some_measurement,customer=A,deviceid=abc some_field=1 1676585506
some_measurement,customer=A,deviceid=def some_field=2 1676585507
some_measurement,customer=B,deviceid=xyz some_field=3 1676585508

```

or have separate measurement like this:

```auto
customerA_some_measurement,deviceid=abc some_field=1 1676585506
customerA_some_measurement,deviceid=def some_field=2 1676585507
customerB_some_measurement,deviceid=xyz some_field=3 1676585508

```

A deviceid will only ever be associated with one customer.

Say those measurements have 100’s millions of rows, 1000’s of deviceid and 20 customerid (assume I’m on iox here!) and I want to quickly find data for deviceid=abc. Is there any difference in efficiency querying measurement “customerA\_some\_measurement” for tag “deviceid=abc” than querying “some\_measurement” for tag “deviceid=abc” and tag “customer=A”?

Thanks,  
Tom
