Is there a way to configure statement_timeout but not affect analytics generation

I have a dhis2 and we use sqlViews api to extract some of the data/statistics
From time to time the queries are too big/too loose that they stuck in postgresql for hours. I’d like to kill these queries after a few minutes (since the http timeout is much lower and the client won’t get the results)

I know that I can configure statement_timeout on postgres but it looks hazardous in regards to the dhis2 “analytics creation” that takes also hours

Is there a possibility in dhis.conf or in the sql view query to specify such parameter but without affecting analytics table/views creation.

Hi @Stephan_Mestach
You can have a look at this SQL script.

You could consider to schedule a cron task to execute this script and terminate long running queries.

Best regards,

1 Like