Historical Queries consuming Connections and Hanging, eventually Fault DB Connection

Hello,

I have some users reporting occasional Red Overlays on a Historical Page. I have noticed I get these query strings that hang as Active Queries on my Database Status Page.

Is there anyway I can turn on some verbose logging and figure out what all those ?'s mean. Maybe through some advanced Logging I can figure out which Python script is doing this crazy query?(I inherited this application and have found some other bugs)

If I jump between two “Runs” of Historical my Easy Chart Populates and Table View populates but this Query hangs as Active even though the Page appears to render. This leads me to believe that some some non-essential code is executing, because Page appears OK but I have a Hung Query. I can eventually Fault the DB if I jump between too many Historical Runs and consume all 8 Connections.

Query: SELECT “tagid”,“intvalue”,“floatvalue”,“stringvalue”,“datevalue”,“t_stamp”,“dataintegrity” FROM sqlt_data_21_2018_08 WHERE “t_stamp”>=? and “t_stamp”<=? and (“tagid”=? OR “tagid”=? OR “tagid”=? OR …(see photo for rest)

This isn’t a user-generated query - that’s the historian looking in a historical partition for data. Those queries are probably running for an excessively long time because they’re running with no bounds. You can try setting the Tags.History.Query loggers to DEBUG, or get in contact with support and they can take a look at your setup and see what’s going on.

Thanks PGriffith,
I turned on the Logs and I will give Support a call for some help.
Its weird it says its Querying for 300 Results but maybe I have only 100 tag Pens on my Easy Chart, but only 10 actually selected.

Wed Aug 01 11:15:26 EDT 2018 Mon Aug 06 11:22:22 EDT 2018
14:32:58.730 [QueryExecuter 5] DEBUG Tags.History.Cache - Quering for 300 results for 12284 second range (window=40949.95333333333) [1533556657369,1533568942355]
14:32:58.840 [QueryExecuter 5] DEBUG Tags.History.Cache.Bucket - Data loaded into bucket in 110 ms. Bucket details: range=12284 sec, start=1533556657369, end=1533568942355, provisional=false, relevency=0.0
14:32:58.840 [QueryExecuter 5] DEBUG Tags.History.Cache.Bucket - Only the first -1 rows of data are good quality. The end of the bucket will be shortend to 0
14:32:58.840 [QueryExecuter 5] DEBUG Tags.History.Cache.Bucket - The bucket will not be registered- either the amount of good data is too small, or the block is too close to the current time.
Mon Aug 06 11:22:22 EDT 2018 Wed Aug 01 11:15:26 EDT 2018
14:34:37.875 [QueryExecuter 3] DEBUG Tags.History.Cache - Quering for 300 results for 8273 second range (window=27579.4) [1533128252858,1533136526678]
14:34:38.025 [QueryExecuter 3] DEBUG Tags.History.Cache.Bucket - Data loaded into bucket in 150 ms. Bucket details: range=8273 sec, start=1533128252858, end=1533136526678, provisional=false, relevency=0.0
14:34:38.025 [QueryExecuter 3] DEBUG Tags.History.Cache.Bucket - Only the first -1 rows of data are good quality. The end of the bucket will be shortend to 0
14:34:38.025 [QueryExecuter 3] DEBUG Tags.History.Cache.Bucket - The bucket will not be registered- either the amount of good data is too small, or the block is too close to the current time.

So I opened the Project in the Designer looked at some scripts and closed it during the time when I turned on the Logs. Now I do not see the Historical Query Hanging in Active Queries. It does still show up but it disappears. Weird.
This Gateway was upgraded to 7.9.7 then I uninstalled and reinstalled 7.9.5. Then I restored the 7.9.5 Gateway Backup. But I have not opened this project in a Designer since I did the 7.9.7 back to 7.9.5 GW Install.