Skip to content

Commit 19a28f7

Browse files
authoredMay 21, 2017
Update generate_report.sh
1 parent cd8e518 commit 19a28f7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎generate_report.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ t_unionall as
978978
select locktype,datname,relation::regclass,page,tuple,virtualxid,transactionid::text,classid::regclass,objid,objsubid,
979979
string_agg(
980980
'Pid: '||case when pid is null then 'NULL' else pid::text end||chr(10)||
981-
'Granted: '||case when granted is null then 'NULL' else granted::text end||' , Mode: '||case when mode is null then 'NULL' else mode::text end||' , FastPath: '||case when fastpath is null then 'NULL' else fastpath::text end||' , VirtualTransaction: '||case when virtualtransaction is null then 'NULL' else virtualtransaction::text end||' , Session_State: '||case when state is null then 'NULL' else state::text end||chr(10)||
981+
'Lock_Granted: '||case when granted is null then 'NULL' else granted::text end||' , Mode: '||case when mode is null then 'NULL' else mode::text end||' , FastPath: '||case when fastpath is null then 'NULL' else fastpath::text end||' , VirtualTransaction: '||case when virtualtransaction is null then 'NULL' else virtualtransaction::text end||' , Session_State: '||case when state is null then 'NULL' else state::text end||chr(10)||
982982
'Username: '||case when usename is null then 'NULL' else usename::text end||' , Database: '||case when datname is null then 'NULL' else datname::text end||' , Client_Addr: '||case when client_addr is null then 'NULL' else client_addr::text end||' , Client_Port: '||case when client_port is null then 'NULL' else client_port::text end||' , Application_Name: '||case when application_name is null then 'NULL' else application_name::text end||chr(10)||
983983
'Xact_Start: '||case when xact_start is null then 'NULL' else xact_start::text end||' , Query_Start: '||case when query_start is null then 'NULL' else query_start::text end||' , Xact_Elapse: '||case when (now()-xact_start) is null then 'NULL' else (now()-xact_start)::text end||' , Query_Elapse: '||case when (now()-query_start) is null then 'NULL' else (now()-query_start)::text end||chr(10)||
984984
'Query: '||case when query is null then 'NULL' else query::text end,
@@ -997,10 +997,10 @@ order by
997997
else 0
998998
end ) desc,
999999
(case when granted then 0 else 1 end)
1000-
)
1000+
) as lock_conflict
10011001
from t_unionall
10021002
group by
1003-
locktype,datname,relation,page,tuple,virtualxid,transactionid::text,classid,objid,objsubid ;
1003+
locktype,datname,relation,page,tuple,virtualxid,transactionid::text,classid,objid,objsubid ;
10041004
EOF
10051005
echo "建议: "
10061006
echo " 锁等待状态, 反映业务逻辑的问题或者SQL性能有问题, 建议深入排查持锁的SQL. "

0 commit comments

Comments
 (0)
Please sign in to comment.