mysql 会话级别的参数_PostgreSQL的参数设置级别及查询各级别的参数值
PostgreSQL的參數(shù)設置級別及查詢各級別的參數(shù)值
系統(tǒng)級別
用戶/角色級別
用戶/角色 + 數(shù)據(jù)庫級別
會話級別
1.查詢某參數(shù)在系統(tǒng)級別的設置
直接到postgresql.conf中去過濾
2.查詢某參數(shù)在某用戶級別的設置
testdb=# create user testa password 'testa';
CREATE ROLE
Time: 85.415 ms
testdb=# alter role testa set log_min_duration_statement = 100;
ALTER ROLE
Time: 12.714 ms
--方法一:查詢pg_user表
testdb=# select * from pg_user where usename='testa';
usename | usesysid | usecreatedb | usesuper | usecatupd | userepl |? passwd? | valuntil |??????????? useconfig
---------+----------+-------------+----------+-----------+---------+----------+----------+----------------------------------
testa?? |??? 25697 | f?????????? | f??????? | f???????? | f?????? | ******** |????????? | {log_min_duration_statement=100}
(1 row)
Time: 1.003 ms
--方法二:查詢pg_db_role_setting表
testdb=# select * from pg_db_role_setting
testdb-# where setrole in (select usesysid from pg_user where usename in ('testa'))
testdb-# order by setrole,setdatabase;
setdatabase | setrole |??????????? setconfig
-------------+---------+----------------------------------
0 |?? 25697 | {log_min_duration_statement=100}
(1 rows)
Time: 1.132 ms
3.查詢某參數(shù)在某用戶下針對數(shù)據(jù)庫級別的設置
testdb=# alter role testa in database testdb set client_min_messages='warning';
ALTER ROLE
Time: 2.111 ms
testdb=# select * from pg_db_role_setting
testdb-# where setrole in (select usesysid from pg_user where usename in ('testa'))
testdb-# order by setrole,setdatabase;
setdatabase | setrole |??????????? setconfig
-------------+---------+----------------------------------
0 |?? 25697 | {log_min_duration_statement=100}
16412 |?? 25697 | {client_min_messages=warning}
(2 rows)
Time: 1.132 ms
4.查詢某參數(shù)在當前會話級別的設置
testdb=> \c testdb testa
You are now connected to database "testdb" as user "testa".
testdb=>
testdb=> select user;
current_user
--------------
testa
(1 row)
testdb=> show client_min_messages;
client_min_messages
---------------------
warning
(1 row)
testdb=> set client_min_messages='error';
SET
testdb=> show client_min_messages;
client_min_messages
---------------------
error
(1 row)
重置/取消這些參數(shù)的設置
ALTER ROLE name [ IN DATABASE database_name ] RESET ALL;
閱讀(2475) | 評論(0) | 轉發(fā)(0) |
總結
以上是生活随笔為你收集整理的mysql 会话级别的参数_PostgreSQL的参数设置级别及查询各级别的参数值的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: qdir 类似工具_qdir 类似工具_
- 下一篇: python中可以使用变量来引用函数吗_