Query running time

I found two tables, query_execution and query, in Metabase. 'query_execution' table shows the query log as start time, running time, card_id , executor_id, 'query' table shows the average execution time for the query ; Two tables are linked by the hash field.

Question 1: What is the mechanism for generating the hash field? For example

  1. For a created card, if the query sql of the card is modified, such as modify filter parameters or replace the SQL with another, will the hash value change?
  2. For a temporary query, if the same SQL statement is executed at two different times, will the hash field are the same one?

Question 2: The query table records the average execution time of the query. What is the time range for calculating this average execution time? Is it from the start time when the query is created or within the last month, etc.?

The query hash is changed when the query changes

If you do a query 3 times and caching is enabled, then the query will be cached and every time a query with the same query hash is built the query will come from the cache

for example i created a reported card with sql as "select columnA from table_b where start_date = '2023-04-25' " , then the query hash is hashA, then i modify then sql to "select columnA from table_b where start_date = '2023-04-26' " , is the query hash changed?

Yes, as the query is different