EXCLUDESTALE
Stale tags are tags that have no new data samples within a specified period of time, and which have the potential to add to system overhead and slow down user queries.
The EXCLUDESTALE query modifier allows for exclusion of stale tags in data queries.
Unless permanently deleted, stale tags from the archiver are not removed but are simply marked as stale. Use the query without the EXCLUDESTALE query modifier to retrieve the sample values.
- Example
-
- Data
-
In this example, the data below is for the last raw samples for Tag1 to Tag7:
Tag, Timestamp, Value Tag1, 9/25/2015 10:00:00, 10 Tag2, 9/18/2015 10:00:00, 20 Tag3, 9/25/2015 10:00:00, 30 Tag4, 9/25/2015 10:00:00, 40 Tag5, 9/18/2015 10:00:00, 50Tag6, 9/25/2015 10:00:00, 60 Tag7, 9/18/2015 10:00:00, 70
- Further Assumptions
-
- Current System Time: 9/26/2015 11:00:00
- Server configuration
- Stale Period: 7 Days
- Stale Period Check: 1 Day
In this case, Tag2, Tag5, and Tag7 were logged more than 7 days ago. They are therefore considered stale.
- Query without EXCLUDESTALE
-
The following query is run at 9/26/2015 11:00:00:
set StartTime='9/17/2015 10:00:00',EndTime='9/26/2015 11:00:00' select TagName,Timestamp,Value from ihrawdata where tagname like Tag* and Samplingmode=RawByTime and CriteriaString="#ExcludeStale"
Output is returned for the following tags:
Tag, Timestamp, Value Tag1, 9/25/2015 10:00:00, 10 Tag3, 9/25/2015 10:00:00, 30 Tag4, 9/25/2015 10:00:00, 40 Tag6, 9/25/2015 10:00:00, 60
In the above query, the stale tags (Tag 2, Tag5, and Tag7) are excluded from the results.
- Query with EXCLUDESTALE:
-
The following query is run at 9/26/2015 11:00:00:
set StartTime='9/17/2015 10:00:00',EndTime='9/26/2015 11:00:00' select TagName,Timestamp,Value from ihrawdata where tagname like Tag* and Samplingmode=RawByTime and CriteriaString="#ExcludeStale"
Output is returned for the following tags:
Tag, Timestamp, Value Tag1, 9/25/2015 10:00:00, 10 Tag3, 9/25/2015 10:00:00, 30 Tag4, 9/25/2015 10:00:00, 40 Tag6, 9/25/2015 10:00:00, 60
In the above query, the stale tags (Tag 2, Tag5, and Tag7) are excluded from the results.
- Anticipated Usage
-
Stale tags have the potential to add to system overhead and slow down user queries, without adding new data. The EXCLUDESTALE modifier can be used to exclude such tags, thereby speeding up query time.