system.tag.queryTagHistory response time in vision

I have a report which query data from historical using “system.tag.queryTagHistory” via its script.
This report response is fast and accurate , but when apply the same script in Vision , i get the same results but within 50X time of the same script in report not vision.
Could you please hint me with the reason and how can i solve it and get the same results with the same time.

I’m going to guess that the script makes multiple queries. Each requires a round trip to the gateway when executed in a client, with serialization and deserialization for transit. Reports are generated on the gateway, so such script calls do not have that overhead. Consider using system.util.sendRequest() to run the script on the gateway and just return the final results.

1 Like

Thank you very much sir , using system.util.sendRequest() solved the issue.