# Using Tables To Give Devices Large Amount of Tags

**URL:** <https://forums.losant.com/t/using-tables-to-give-devices-large-amount-of-tags/5665>\
**Category:** Help\
**Tags:** experience, data-table, tags\
**Created:** [October 31, 2024, 1:34pm UTC](https://forums.losant.com/t/using-tables-to-give-devices-large-amount-of-tags/5665 "2024-10-31T13:34:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tanner\_Williams](https://avatars.discourse-cdn.com/v4/letter/t/e274bd/32.png) [@Tanner\_Williams](https://forums.losant.com/u/Tanner_Williams)\
**Post date:** [October 31, 2024, 1:34pm UTC](https://forums.losant.com/t/using-tables-to-give-devices-large-amount-of-tags/5665/1 "2024-10-31T13:34:15Z")

</div>

> [@Device tag value max size](https://forums.losant.com/t/device-tag-value-max-size/3823):
>
> I’m assuming the device tag value portion of the key/value is a string. What is the maximum number of characters that the value portion can hold?

So I saw this post referencing that

> [@Device tag value max size](https://forums.losant.com/t/device-tag-value-max-size/3823/3):
>
> Values can be a maximum of 255 characters, with no limits on the acceptable characters.
> 
> Keys must also be no longer than 255 characters,

And also

> [@Device tag value max size](https://forums.losant.com/t/device-tag-value-max-size/3823/5):
>
> Devices - and other resources that can support tags - can have a maximum of 100 entries.

At the current time, I don’t believe we have enough users or devices for our plan to exceed the tag limit. However, I’m considering, for the future, a solution for storing user alerting preferences for each device they have access to.

For example:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/2/2b5cc8606f747b1e15446577b8d2b8fd0fe0c2ef.png)

I’m thinking that the best way to approach this would be to have the tag of a table id on the device linking to its table with all of its users’ stored preferences, similar to a foreign key.

**My main question is** : With the current structure and storage limitations, would this be the best approach to handle the scalability of storing user preferences?

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [October 31, 2024, 2:29pm UTC](https://forums.losant.com/t/using-tables-to-give-devices-large-amount-of-tags/5665/2 "2024-10-31T14:29:51Z")

</div>

I don’t think I would store any information on the device or the user object; instead, I would use a single data table with columns for `experienceUserId` and `deviceId` - as it sounds like what you want to store is per-user, per-device preferences. Then, other columns in the table could store whatever those key-value preference pairs are.

Then, when it comes time to save a user’s preferences, it’s a table upsert for the row matching the `experienceUserId` and `deviceId`.

As for sending alerts, the Device State Trigger could look up all rows matching the `deviceId`; iterate over them to see, given the preferences, which users should receive a notification; and then send those notifications. This last bit could get messy as your application achieves a greater scale, but some of those processes can be passed off to separate workflow runs using the [Workflow Trigger Node](https://docs.losant.com/workflows/outputs/workflow-trigger/).

---

<div class="post-metadata">

**Author:** ![Tanner\_Williams](https://avatars.discourse-cdn.com/v4/letter/t/e274bd/32.png) [@Tanner\_Williams](https://forums.losant.com/u/Tanner_Williams)\
**Post date:** [October 31, 2024, 2:34pm UTC](https://forums.losant.com/t/using-tables-to-give-devices-large-amount-of-tags/5665/3 "2024-10-31T14:34:57Z")

</div>

what would be the purpose of triggering other workflows rather than running it all on one workflow? What are you suggesting should be split up?

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [October 31, 2024, 2:40pm UTC](https://forums.losant.com/t/using-tables-to-give-devices-large-amount-of-tags/5665/4 "2024-10-31T14:40:38Z")

</div>

The possibility of the flow timing out, as a single run can only go 60 seconds maximum. Theoretically at scale …

- One device state report fetches hundreds, maybe thousands, of data table rows (one for each user with a preference matching the device ID)
- A Function Node (most efficient in this scenario) determines which users need a notification given the returned preferences and the attribute value(s) in the state report
- If, say, a hundred need a notification, that’s 100 requests to Twilio, SendGrid, a third-party API, or whatever it is you are doing to alert your users. This is where you run a timeout risk.

---

<div class="post-metadata">

**Author:** ![Tanner\_Williams](https://avatars.discourse-cdn.com/v4/letter/t/e274bd/32.png) [@Tanner\_Williams](https://forums.losant.com/u/Tanner_Williams)\
**Post date:** [October 31, 2024, 2:45pm UTC](https://forums.losant.com/t/using-tables-to-give-devices-large-amount-of-tags/5665/5 "2024-10-31T14:45:24Z")

</div>

makes sense, thanks!
