Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

384
Views
How to query data based off of Grafana's absolute time range?

I have a grafana dashboard that is connected to a PostgreSQL database. I understand how to change the absolute time range to show a time range on a graph, but am wondering if it is possible to change my query to reflect that for a total.

For example, I have a query that gets the total number of rows:

SELECT
  COUNT(*) as "Total Number of Rows:"
FROM mytable

Is it possible to show the total number of rows for the specified time in grafana (ex. past 30 days, past 6 hours, etc)?

Thanks!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You have to modify your query as follow:

SELECT
  $__time(time_column),
  count(*) as "Total Number of Rows:"
FROM
  mytable
WHERE
  $__timeFilter(time_column) 
GROUP BY time_column

In this way Grafana will filter using $__timeFilter on the specified time_column

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!