Dipu R
Dipu R

Reputation: 575

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

Upvotes: 16

Views: 34370

Answers (1)

greg
greg

Reputation: 3495

Simply send the following statement:

set statement_timeout TO 100;

Postgresql will then cancel all queries exceeding 100ms.

Upvotes: 20

Related Questions