Accessing Netezza Query History Details Using nz_query_history Table

Prerequisites

Accessing Query History Details

  1. Connect to your Netezza database using a tool that supports running SQL queries, such as pgAdmin, Navicat for Netezza, or sqlcli.
  2. Execute the following query to retrieve query history details from the nz_query_history table:
SELECT * FROM nz_query_history WHERE job_id = 'your_job_id';

Replace 'your_job_id' with the actual job ID for the query you want to inspect. If you are interested in all queries executed within a specific timeframe, replace 'your_job_id' with the appropriate conditions (e.g., WHERE start_time >= 'start_date' AND start_time <= 'end_date';).

Example Query Output

job_id start_time end_time user_name application_name num_rows_affected num_bytes_read num_bytes_written num_bytes_spilled num_bytes_cached status
1234567890 2022-03-01 09:00:01.000 2022-03-01 09:00:03.000 john_doe psql 0 1024 0 0 0 success
876543210 2022-03-01 09:05:01.000 2022-03-01 09:05:05.000 jane_doe psql 1000 8192 6400 0 1024 success

Columns Description

Conclusion

By leveraging the nz_query_history table, you can effectively monitor query performance, identify potential issues, and optimize your Netezza database workloads more efficiently. Analyzing the data returned from this system catalog view allows you to make informed decisions to improve overall system performance and optimize your queries for better results.