3

Postgres has syntax to show the query plan for a SQL statement:

https://www.postgresql.org/docs/9.4/using-explain.html

Does QuestDB have something equivalent so that I can see the query plan that would result from my SQL before actually executing it?

marregui
  • 91
  • 4

2 Answers2

1

QuestDB added the EXPLAIN clause a few weeks ago. There is a nice blogpost with details for interpreting the results, but if you just want to start using it all you have to do is prefix your queries with the EXPLAIN keyword

Javier Ramirez
  • 3,446
  • 24
  • 31
0

The QuestDB docs show an explain option for the /exec HTTP endpoint. However, I can't get it to work on my instance running v6.2.

It should work like this:

curl -G \
    --data-urlencode "query=select * from t limit 2;" \
    --data-urlencode "explain=true" \
    http://localhost:9000/exec
nslocum
  • 5,037
  • 1
  • 27
  • 27
  • "explain" url parameter is not the same as "EXPLAIN" keyword. It causes backend to return a bit of metadata ('jitCompiled' flag) along with result . – Bolek Ziobrowski Apr 12 '23 at 10:06