Php max runtime - postgresql

Is it possible to use PostgreSQL functions in PHP, so you can specify the maximum query execution time? I do not want to include this from the configuration file because I need to limit only certain requests.

+4
source share
2 answers

run from php request before the main request

as

SET statement_timeout TO 5000; 
+5
source

You can use set_time_limit() According to the PHP doc:

When called, set_time_limit() restarts the timeout counter from zero. In other words, if the timeout is the default 30 seconds, and 25 seconds into script execution a call such as set_time_limit(20) is made, the script will run for a total of 45 seconds before timing out When called, set_time_limit() restarts the timeout counter from zero. In other words, if the timeout is the default 30 seconds, and 25 seconds into script execution a call such as set_time_limit(20) is made, the script will run for a total of 45 seconds before timing out .

+1
source

Source: https://habr.com/ru/post/1336919/


All Articles