【问题标题】:Set statement_timeout on a per-user basis in YugabyteDB在 YugabyteDB 中为每个用户设置 statement_timeout
【发布时间】:2021-12-03 14:30:03
【问题描述】:

[用户在YugabyteDB Community Slack上发布的问题]

Postgres 提供了一种通过更改角色为每个用户设置 statement_timeout 的方法:https://www.postgresql.org/docs/11/sql-alterrole.html

有一种已知的解决方法可以在连接建立后设置 statement_timeout,但在角色级别设置它会很有帮助。

YugabyteDB 也有可用的东西吗?

【问题讨论】:

    标签: yugabyte-db


    【解决方案1】:

    这应该已经可以像在 PostgreSQL 中一样。示例:

    yugabyte=# ALTER ROLE yugabyte SET statement_timeout = 5000;
    

    然后打开另一个shell并尝试这样做:

    yugabyte=# select pg_sleep(5);
    ERROR:  canceling statement due to statement timeout
    yugabyte=# select pg_sleep(4);
     pg_sleep 
    ----------
     
    (1 row)
    

    在 2.9.0.0 上测试

    【讨论】:

      猜你喜欢
      • 2014-07-28
      • 2020-09-21
      • 1970-01-01
      • 1970-01-01
      • 2022-08-04
      • 1970-01-01
      • 1970-01-01
      • 2017-11-30
      • 2013-08-09
      相关资源
      最近更新 更多