Extracting query-history in SAP HANA

Nishanth Reddy picture Nishanth Reddy · Dec 16, 2014 · Viewed 9.8k times · Source

I have been using SAP HANA db instance, and have been running several queries on this. I need to extract the query-history, preferably from a system-table or elsewhere. Please let me know if this is possible and any pointers to achieve it, if possible.

Answer

Timo D picture Timo D · Dec 18, 2014

If you want a detailed history of executed queries, you need to activate the HANA SQL trace. You can find more information in the HANA documentation. Of course, this will not work retrospectively. So you will have to activate the trace first and then run the queries that you want to look at.

Additionally, the SQL Plan Cache provides aggregated information about past queries. It is aggregated by the prepared statements and provides runtime information like average execution time and result size. The monitoring view for this is SYS.M_SQL_PLAN_CACHE.