EXAMINEFEW

Queries using calculation modes normally loop through every raw sample, between the given start time and end time, to compute the calculated values.

When using FirstRawValue, FirstRawTime, LastRawValue, and LastRawTime calculation modes, we can use only the raw sample near each interval boundary and achieve the same result. The EXAMINEFEW query modifier enables this. If you are using one of these calculation modes you may experience better read performance using the EXAMINEFEW query modifier.

Note: Use the EXAMINEFEW query modifier only with FirstRawValue, FirstRawTime, LastRawValue, and LastRawTime calculation modes.
Examples using EXAMINEFEW with FirstRawValue and FirstRawTime Calculation Modes

Import this data to Historian:

[Tags]
Tagname,DataType,HiEngineeringUnits,LoEngineeringUnits
Tag1,SingleFloat,60,0
[Data]
Tagname,TimeStamp,Value,DataQuality
Tag1,07-05-2011 17:24:00,29.72,Bad
Tag1,07-05-2011 17:25:00,29.6,Good
Tag1,07-05-2011 17:26:00,29.55,Good 
Tag1,07-05-2011 17:27:00,29.49,Bad
Tag1,07-05-2011 17:28:00,29.53,Bad
Tag1,07-05-2011 17:29:00,29.58,Good
Tag1,07-05-2011 17:30:00,29.61,Bad
Tag1,07-05-2011 17:31:00,29.63,Bad
Tag1,07-05-2011 18:19:00,30,Good
Tag1,07-05-2011 18:20:00,29.96,Good
Tag1,07-05-2011 18:21:00,29.89,Good
Tag1,07-05-2011 18:22:00,29.84,Good
Tag1,07-05-2011 18:23:00,29.81,Bad
Using FirstRawValue Calculation Mode
set starttime='07-05-2011 16:00:00', endtime='07-05-2011 19:00:00'
select timestamp,value,quality from ihrawdata where tagname like 'Tag1' and samplingMode=Calculated and 
CalculationMode=FirstRawValue and criteriastring="#EXAMINEFEW" and intervalmilliseconds=1h

The output is as follows:

Time StampValueQuality
07-05-2011 17:00:0000.00000000.0000000
07-05-2011 18:00:0029.6000000100.0000000
07-05-2011 19:00:0030.0100.0000000
Note: The EXAMINEFEW query modifier does not affect query results, but may improve read performance.
Using FirstRawTime Calculation Mode
set starttime='07-05-2011 16:00:00', endtime='07-05-2011 19:00:00'
select timestamp,value,quality from ihrawdata where tagname like 'Tag1' and samplingMode=Calculated and 
CalculationMode=FirstRawTime and criteriastring="#EXAMINEFEW" and intervalmilliseconds=1h

The output is as follows:

Time StampValueQuality
07-05-2011 17:00:0001-01-1970 05:30:000.0000000
07-05-2011 18:00:0007-05-2011 17:25:00100.0000000
07-05-2011 19:00:0007-05-2011 18:20:00100.0000000
Note: The EXAMINEFEW query modifier does not affect query results, but may improve read performance.
Anticipated Usage

Using the EXAMINEFEW modifier is recommended when:

  • The time interval is greater than 1 minute.
  • The collection interval is greater than 1 second.
  • The data node size is greater than the default 1400 bytes.
  • The data type of the tags is String or Blob.
Note: Query performance varies depending on all of the above factors.