How to view running SQL or SQL executed in the past hour?
How to view running SQL or SQL executed in the past hour?
-
I have solved!
cd /var/lib/heavyai/storage/log
tail -f heavydb.INFO -
Hi,
Turning on the enable-logs-system-tables parameter using heavy is an easier way to do that.conf file.
After adding the parameter to the configuration file and restarting the database, a new table called request_logs will pop-up in the information_schema's database.Switch to information_schema's database with
alter session set currect_database='information_schma';
To get the queries that runs in the past hour, just run this SQL to get all the query you run in the last hour with timings
select log_timestamp,query_string,execution_time_ms from request_logs where log_timestamp > dateadd('hour',2-1,now());
The 2-1 is now() will return the timestamp in UTC, and being in UTC+2, I have to add 2 to get the local time.
Hope this help,
Candido
Please sign in to leave a comment.
Comments
2 comments