Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set postgres query execution timeout from application level?

I am creating a web application in php(using Laravel), I would like to set a query execution timeout to PostgreSQL but I don't have access to server configuration, so is there any other way set query execution timeout through application level?

Thank you

like image 855
Dipu R Avatar asked Jul 01 '16 09:07

Dipu R


1 Answers

Simply send the following statement:

set statement_timeout TO 100;

Postgresql will then cancel all queries exceeding 100ms.

like image 52
greg Avatar answered Oct 20 '22 11:10

greg