14

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

1
  • 2
    Use a DB-level or user-level configuration: 1. ALTER DATABASE postgres SET statement_timeout='1s'; 2. ALTER ROLE postgres SET statement_timeout='1s'; Apr 20, 2019 at 10:24

1 Answer 1

17

Simply send the following statement:

set statement_timeout TO 100;

Postgresql will then cancel all queries exceeding 100ms.

1
  • 1
    thank you, for you quick response, is there any PDO configuration or is there any way to run an init query in laravel?
    – Dipu R
    Jul 1, 2016 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.