Configuring query history service

Learn how to modify the default configuration of the query history service in Cloudera Hive to manage query history settings more effectively.

Make sure the Log Hive queries option is enabled.

  1. Log in to the Cloudera Data Warehouse service
  2. Go to the Virtual Warehouses tab. Select the Hive Virtual Warehouse, click > Edit
  3. Go to the Configurations tab. Select hive-site from the Configuration files drop-down menu, and add the following properties to modify the values as required:
    1. hive.query.history.explain.plan.enabled (Default: true)
      Determines whether to collect and store the explain plan in the query history.
    2. hive.query.history.exec.summary.enabled (Default: true)
      Specifies whether to collect and store the execution summary in the query history.
    3. hive.query.history.batch.size (Default: 200)
      Specifies the maximum number of records that can be held in memory before the query history service persists them to the target table. Smaller values (e.g., 1-5) enable more real-time behavior but result in smaller files. Setting this property to 0 forces synchronous persistence of records, Cloudera does not recommend for production environments
    4. hive.query.history.max.memory.bytes (Default: 20mb)
      Defines the maximum memory size, in bytes, that the query history queue can occupy before the service persists records to the target table. Setting this property to 0 disables the memory limit, Cloudera does not recommend in production environments to prevent excessive memory usage in HiveServer2.
    5. hive.query.history.flush.interval.seconds (Default: 1h)
      Specifies the time interval, in seconds, for flushing query history records from memory to the Iceberg table, regardless of the batch size. This ensures timely access to query history records. The default value is 1 hour, balancing file size and record availability. Setting this property to 0 disables the interval-based flush, relying solely on batch size for persistence.
    6. hive.query.history.repository.class (Default: org.apache.hadoop.hive.ql.queryhistory.repository.IcebergRepository)
      Indicates the class that implements QueryHistoryRepository, which is responsible for persisting query history records.
  4. Click Apply Changes and restart Hive.