16

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'; Commented Apr 20, 2019 at 10:24

1 Answer 1

23

Simply send the following statement:

set statement_timeout TO 100;

Postgresql will then cancel all queries exceeding 100ms.

Sign up to request clarification or add additional context in comments.

1 Comment

thank you, for you quick response, is there any PDO configuration or is there any way to run an init query in laravel?

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.