https://questdb.io logo
Title
g

Gabriel Mocan

05/05/2023, 11:17 AM
Hello dear colleagues, here I am again šŸ˜… Regarding the following query, I have 2 questions: • indexing both
net
and
inet
columns will yield better performance as they are the search needle in this query? • This query runs extremely fast on QuestDB UI (average of 500ms including network delay), but in Grafana is taking around 10 secs. I’m wondering if this difference is only ā€œplot timeā€ of points on chart by Grafana…
SELECT
  $__time(timestamp),
  "as" || ' via ' || "host" AS metric,
  sum(value)/($__interval_ms/60000) AS "bps"
FROM "bytinDstNet"
WHERE
  $__timeFilter(timestamp) AND
  net in($net) AND
  inet in($inet)
SAMPLE BY $__interval FILL(0);
a

Andrey Pechkurov

05/05/2023, 12:14 PM
Hi Gabriel, The database will use only a single index in this case. To see the execution plan you can use EXPLAIN statement:
g

Gabriel Mocan

05/05/2023, 12:57 PM
Thanks @Andrey Pechkurov , will check!