View the original community article here
Last tested: June 2021
The query ID is tied to a particular query. It's uniquely identified by a combination of SQL text, connection, and possibly other fields. It is created the first time a SQL query is run on a connection. Query IDs are not changeable or destructible.
The history ID is tied to a running of a query. So, every time a query is run, a history ID is created. A given query ID could be associated with several history IDs: one for each time it's run. History IDs are also not changeable or destructible.
This content is subject to limited support.