Skip to main content
1-Visitor
April 28, 2020
Solved

Data Tags vs Field

  • April 28, 2020
  • 2 replies
  • 1269 views

Philosophical question for folks.

 

Why would you use data tagging (like in a stream) versus just adding a field to the datashape (effectively adding a new "column").

 

Is there additional functionality behind data tagging?

It doesn't seem faster to query using tags (vs just using "time"). 

Are there pros/cons to using one or the other?

 

I just don't really understand the point behind the data tags.

Best answer by Constantine

Hello @a-dub,

 

ThingWorx allocates a dedicated column for tags in the underlying SQL tables (you can see it for Streams, Things, etc.) This column is indexed and therefore the queries should be faster, compared to filtering by a "normal" field, which happens in memory once all data has been fetched.

 

Tags act similar to sets, e.g. you can add them without worrying about duplicates, and the platform also ensures that it works correctly for queries (you don't need to worry about your LIKE filter treating "testdata" together with "data", if you see what I mean)

 

/ Constantine

2 replies

18-Opal
April 29, 2020

Hello @a-dub,

 

ThingWorx allocates a dedicated column for tags in the underlying SQL tables (you can see it for Streams, Things, etc.) This column is indexed and therefore the queries should be faster, compared to filtering by a "normal" field, which happens in memory once all data has been fetched.

 

Tags act similar to sets, e.g. you can add them without worrying about duplicates, and the platform also ensures that it works correctly for queries (you don't need to worry about your LIKE filter treating "testdata" together with "data", if you see what I mean)

 

/ Constantine

Support
May 7, 2020

Hi @a-dub.

 

If the previous response answered your question, please mark it as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon