statement_timeout 在 postgresql 被用来控制语句执行时长,单位是ms。
$ vi postgresql.conf #statement_timeout = 0 # in milliseconds, 0 is disabled
默认是0,表示语句可以一直执行下去。
如果设置为1440000,那就意味着语句最多可以执行 1440000ms = 1440s = 24min。
建议设置为0,禁用该参数。
postgres=# select * postgres-# from pg_settings ps postgres-# where 1=1 postgres-# and ps.name like '%statement_timeout%' postgres-# ; -[ record 1 ]--------------------------------------------------- name | statement_timeout setting | 1440000 unit | ms category | client connection defaults / statement behavior short_desc | sets the maximum allowed duration of any statement. extra_desc | a value of 0 turns off the timeout. context | user vartype | integer source | configuration file min_val | 0 max_val | 2147483647 enumvals | boot_val | 0 reset_val | 14400000 sourcefile | /etc/postgresql/9.1/main/postgresql.conf sourceline | 473