Principle:Apache Druid Query History
| Knowledge Sources | |
|---|---|
| Domains | SQL_Querying, Developer_Experience |
| Last Updated | 2026-02-10 00:00 GMT |
Overview
A query persistence principle that maintains a local history of executed queries for recall, re-execution, and iterative development.
Description
Query History captures and persists executed queries in the browser's localStorage, enabling users to recall and re-execute previous queries. The history serves as a lightweight version control for iterative query development.
Key behaviors:
- Queries are added to history after each execution
- Duplicate consecutive queries are not added (deduplication via JSON comparison)
- History is capped at a maximum number of entries (currently 10)
- Each entry stores the full WorkbenchQuery object (query text + context) with an ISO timestamp
- History persists across browser sessions via localStorage
Usage
Use this principle for iterative query development where users need to recall and modify previous queries. The history dialog is accessible from the Workbench toolbar.
Theoretical Basis
Query history follows a bounded LIFO stack with deduplication pattern:
History Stack:
maxEntries = 10
addQueryToHistory(query):
if history[0] == query: // JSON deep comparison
return // Deduplicate
history = [{ version: ISO_timestamp, query }, ...history].slice(0, maxEntries)
persist(history) // localStorage
getHistory():
return parse(localStorage[WORKBENCH_HISTORY]) || []