The SQL Server query optimizer may incorrectly parse a complex query and not send certain query criteria to the Historian OLE DB provider for handling. This can cause unexpected results for the data.If you suspect that this is happening, use SQL Server Management Studio tools to examine the query plan that the optimizer is using and then modify your query so that the needed criteria gets directed to the Historian OLE DB provider. This is why we join tag onto LIVE when getting current Values.
Because we access some tables over a Linked Server,
Instead of using:
.. WHERE TagName IN (SELECT TagName ...)
It is more efficient to use:
INNER REMOTE JOIN syntax.
You should use ‘REMOTE’ only if the right table is on the Remote server and left is local. Also REMOTE should be used only when the left table has fewer rows than the right table. In our case, when the query plan is confused (see above) and we need to join tag onto live before passing the tags through, it is more efficient to query tag and join this remotely onto live.