简体   繁体   中英

Grafana timeseries with Postgresql: GROUP BY doesn't work

I have a table:

CREATE TABLE IF NOT EXISTS "case_closed" (
"case_id" varchar(256) NOT NULL,
"closed_at" TIMESTAMP WITH TIME ZONE,
"disposition" VARCHAR(128),
PRIMARY KEY ("case_id")
);

And in Grafana, I need to display more than one graph, one per each 'disposition' value (I have 2 different disposition values at the moment).

I'm trying this query:

SELECT
  $__timeGroupAlias(closed_at, $__interval),
  disposition AS "metric",
  COUNT(*) AS "value"
FROM case_closed 
WHERE 
  $__timeFilter(closed_at)
GROUP BY 1,2
ORDER BY 1

And it gives me this ugly picture with only one single graph: 在此处输入图像描述

I searched here and from all I can see my query seems to be okay, but it still doesn't work. Maybe I'm missing something and it's not the query but some settings??

Solved: There was a small thing in the Query Builder (not sure why I didn't see it in any documentation): 在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM