https://questdb.io logo
Title
s

Super Richman

04/16/2023, 1:53 PM
are subqueries cached? or only the final results
b

Bolek Ziobrowski

04/17/2023, 8:17 AM
It really depends on the case . By default subqueries are not cached but some might require materialization (e.g. hashed part of hash join, order by + limit ) .
s

Super Richman

04/17/2023, 8:28 AM
yes so I saw that in my case the first query takes 1 second and the next query takes 50ms, so the subquery is cached
I am doing SELECT colX FROM (SUBQUERY)
b

Bolek Ziobrowski

04/17/2023, 8:46 AM
Query metadata is cached but result is not . What you've observed is likely cold vs hot data performance.
s

Super Richman

04/17/2023, 9:20 AM
oh no.. what does it mean? as well during runtime the first query is timed out but the ones after are not
b

Bolek Ziobrowski

04/17/2023, 9:28 AM
Even though it times out first query could simply prime the data in OS page cache .
s

Super Richman

04/17/2023, 9:37 AM
it says much
i.q.c.p.PGConnectionContext query cache used [fd=34248]
b

Bolek Ziobrowski

04/17/2023, 9:56 AM
query cache only stores query plans, not the data or result .
s

Super Richman

04/17/2023, 10:26 AM
:[ Bolek I dont want to bother you, maybe you can point me to some documentation on this?
b

Bolek Ziobrowski

04/17/2023, 10:36 AM
I don't think query cache is documented apart from pg.cache. and http.query.cache.* references on https://questdb.io/docs/reference/configuration/ .