Skip to content

Commit 5fbdcc8

Browse files
authored
Update generate_report.sh
1 parent 19a28f7 commit 5fbdcc8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

generate_report.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,8 @@ string_agg(
981981
'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)||
984-
'Query: '||case when query is null then 'NULL' else query::text end,
984+
'SQL (Current SQL in Transaction): '||chr(10)||
985+
case when query is null then 'NULL' else query::text end,
985986
chr(10)||'--------'||chr(10)
986987
order by
987988
( case mode
@@ -996,11 +997,11 @@ order by
996997
when 'AccessExclusiveLock' then 8
997998
else 0
998999
end ) desc,
999-
(case when granted then 0 else 1 end)
1000+
(case when granted then 0 else 1 end)
10001001
) as lock_conflict
10011002
from t_unionall
10021003
group by
1003-
locktype,datname,relation,page,tuple,virtualxid,transactionid::text,classid,objid,objsubid ;
1004+
locktype,datname,relation,page,tuple,virtualxid,transactionid::text,classid,objid,objsubid ;
10041005
EOF
10051006
echo "建议: "
10061007
echo " 锁等待状态, 反映业务逻辑的问题或者SQL性能有问题, 建议深入排查持锁的SQL. "

0 commit comments

Comments
 (0)