Revision: 15/02/2025
Query History Command¶
The query-history (or qh) command group tracks and analyzes user query performance and history.
Usage¶
Subcommands¶
log¶
Log a query to the history tracking system manually.
Arguments:
query: The query text to log.
Options:
--user-id <id>: User ID associated with the query.--engine <engine>: Engine used (sql,pgq,cypher).--results <number>: Number of results returned.--latency <ms>: Query latency in milliseconds.-f, --format <type>: Output format (json|table|markdown).
export¶
Export query history to a file (JSON or CSV).
Options:
--user-id <id>: Filter by user ID.--format <type>: Export format (jsonorcsv) (default:json).--output <path>: Output file path.--time-range <range>: Time range (1h,24h,7d,30d) (default:24h).
retrieve¶
Retrieve recent query history.
Options:
--user-id <id>: Filter by user ID.--limit <number>: Number of queries to retrieve (default: 50).--offset <number>: Pagination offset (default: 0).--engine <engine>: Filter by engine.-f, --format <type>: Output format.
stats¶
Get statistics on query history (e.g., query counts, average latency).
Options:
--user-id <id>: Filter by user ID.--time-range <range>: Time range.--group-by <field>: Group by field (engine,user,hour,day).-f, --format <type>: Output format.
cleanup¶
Cleanup old query history entries.
Options:
--older-than <days>: Delete queries older than N days (default: 90).--confirm: Skip confirmation prompt.-f, --format <type>: Output format.