ALTER ROLE ... SET parameter;
Komutu kullanarak, kullanıcıya özgü günlük parametrelerini uyarlamak mümkün oldu. Parametrenin yalnızca oturumu kapattıktan sonra geçerli olduğunu unutmayın.
Log_min_duration_statement = -1 ayarı (ilk giriş):
psql konsolu
P:\>psql -U postgres -h 132.156.208.45 -d my_db
my_db=# SHOW log_min_duration_statement;
log_min_duration_statement
----------------------------
0
(1 ligne)
my_db=# SELECT COUNT(*) FROM organisms;
count
-------
153
(1 ligne)
my_db=# ALTER ROLE postgres SET log_min_duration_statement=-1;
ALTER ROLE
my_db=# SHOW log_min_duration_statement;
log_min_duration_statement
----------------------------
0
(1 ligne)
my_db=# SELECT COUNT(*) FROM mv_rings;
count
--------
115270
(1 ligne)
my_db=# \q
Günlükte sonuç:
Bu oturumda, log_min_duration_statement = -1 ayarlandıktan sonra bile tüm ifadelerin günlükte görülebileceğini unutmayın.
2015-10-15 14:14:01 EDT [unknown] my_db 123.456.789.012 postgres |LOG: connection authorized: user=postgres database=my_db
2015-10-15 14:14:08 EDT psql my_db 123.456.789.012 postgres |LOG: duration: 0.000 ms statement: SHOW log_min_duration_statement;
2015-10-15 14:15:26 EDT psql my_db 123.456.789.012 postgres |LOG: duration: 32.000 ms statement: SELECT COUNT(*) FROM organisms;
2015-10-15 14:15:45 EDT psql my_db 123.456.789.012 postgres |LOG: duration: 31.000 ms statement: ALTER ROLE postgres SET log_min_duration_statement=-1;
2015-10-15 14:16:08 EDT psql my_db 123.456.789.012 postgres |LOG: duration: 0.000 ms statement: SHOW log_min_duration_statement;
2015-10-15 14:17:10 EDT psql my_db 123.456.789.012 postgres |LOG: duration: 2059.000 ms statement: SELECT COUNT(*) FROM mv_rings;
2015-10-15 14:17:29 EDT psql my_db 123.456.789.012 postgres |LOG: disconnection: session time: 0:03:27.450 user=postgres database=my_db host=123.456.789.012 port=65269
Log_min_duration_statement (2. giriş) etkisini görme:
psql konsolu
P:\>psql -U postgres -h 132.156.208.45 -d my_db
my_db=# SHOW log_min_duration_statement;
log_min_duration_statement
----------------------------
-1
(1 ligne)
my_db=# SELECT COUNT(*) FROM germplasms;
count
--------
475290
(1 ligne)
my_db=# \q
Günlükte sonuç:
Beklendiği gibi, ifadelerin hiçbiri kaydedilmez.
2015-10-15 14:17:44 EDT [unknown] my_db 123.456.789.012 postgres |LOG: connection authorized: user=postgres database=my_db
2015-10-15 14:20:27 EDT psql my_db 123.456.789.012 postgres |LOG: disconnection: session time: 0:02:43.333 user=postgres database=my_db host=123.456.789.012 port=49372
ALTER USER ... SET log_connections = off
vb.