Touch function
The touch()
function loads a table from disk to memory. Useful for triggering
a "hot" start from conditions where data may be "cold", such as after a restart
or any condition which caused disk cache to flush. A "hot" start provides the
usual fast and expected query performance, as no caching or movement from disk
to memory is required prior to an initial query.
#
Arguments:Wraps a SQL statement.
#
Return valueReturns an object
representing index state.
See the Index documentation for more information on how the above values are determined.
#
General exampleConsider a table with an indexed symbol column:
Run touch()
to "warm up" the table:
On success, an object is returned with the state of the index.
#
Practical exampleMany people use scripts to restart QuestDB.
Use touch()
after startup via the REST API:
All subsequent queries will be within performance expectations, without additional latency added for "warming up" the data. Touch simulates a query without transferring data over the network, apart from the object as confirmation.