云服务器价格_云数据库_云主机【优惠】最新活动-搜集站云资讯

域名备案_dns域名注册_排行榜

小七 141 0

If you want to find out what are the frequently executed statement or query or a view in HANA  per client which connects to HANA DB ,below SQL will help with the same . Here I am displaying top 5 statements ,aggregated per client.(Eg Clients that connects here: -WebIntelligence,ABAP,Mashup Engine etc.

=========

with cte as (select distinct statement_hash, application_name,count(statement_hash) as num, rank() over ( partition by application_name order by count(statement_hash)desc) R from m_expensive_statements group by statement_hash,application_name order by application_name desc)

select * from cte where R in (‘1′,’2′,’3′,’4′,’5’);

======

The above sql outputs the top 5 statement hashes that each of the applications like SLT,Studio,ABAP,WebIntelligence etc along with the number of times it was executed in HANA DB based on the data available in M_EXPENSIVE_STATEMENTS .

If you want to find out the SQL associated with these statement hashes refer my below blog for more details.

https://blogs.sap.com/2020/09/16/how-to-find-sql-statement-from-sql-hash/

WARNING:

-The sub sql involved does not segregate between successful and failed statements. If you want to be very specific about checking on only successful statements alone, add an additional clause as ERROR_CODE=0 .For failed statements go for ERROR_CODE ‘0’

eg:

with cte as (select distinct statement_hash, application_name,count(statement_hash) as num, rank() over ( partition by application_name order by count(statement_hash)desc) R from m_expensive_statements where ERROR_CODE =’0′ group by statement_hash,application_name order by application_name desc)

select * from cte where R in (‘1′,’2′,’3′,’4′,’5’);

-If you have no records inside M_EXPENSIVE_STATEMENTS, it means you have not enabled the expensive statement trace .Hence before trying any of the above, ensure that you have enabled the expensive statement trace and with default threshold for memory,cpu and duration such as all the statements that are running in HANA db gets recorded.

Hope it was helpful!! Click on like if you found this article useful and FOLLOW for more such articlesRajarajeswari Kaliyaperuumal

Please leave a comment or suggestion!

,数据分析工具有哪些,云服务器多少钱,人工智能知识体系,人工智能龙头企业,购返利