Quantcast
Channel: OSIsoft Users Community
Viewing all articles
Browse latest Browse all 1120

Most performant way to query for 50+ tags historical?

$
0
0

Hi There - I run queries against pimax, pimin, and piavg from a linked SQL Server. I have this working very well as pass-through using an SQL OPENQUERY with the SQL WHERE below. I often want to query for say a 5-min timestep of 50+ tags for a week or even a month. The results are then rendered on displays. Mostly my approach works acceptably. However if I want to query say daily timestep for 100 days the query may become terribly slow.

 

Is the syntax below efficient? It doesn't work well in some combinations of time period and timestep. - Thanks in advance.

 

 

SELECT tag, time, value FROM piarchive.piavg

WHERE TAG IN

(

tag1,

tag2,

tag3,

etc. up to 50+ tags

)

AND timestep

AND TIME >=

AND TIME <=


Viewing all articles
Browse latest Browse all 1120

Trending Articles