promscale icon indicating copy to clipboard operation
promscale copied to clipboard

Replace the BETWEEN operator in Grafana Postgres DS

Open mjf opened this issue 4 years ago • 7 comments

The Postgres data source (DS) in Grafana uses the SQL BETWEEN operator for the "time" column which can be incorrect for edge-cases (see "Don't Do This"). Provide new switch in the Postgres DS settings to replace the BETWEEN operator in the DS macros (preferably defaulting to be switched on for TimescaleDB-enabled DS and switched off for the Postgres-only DS).

mjf avatar May 19 '21 10:05 mjf

Hi @mjf

The team that deals with Grafana has been intimated about this. They will take a look soon.

nikkhils avatar May 21 '21 09:05 nikkhils

@nikkhils That's great! Thank you.

mjf avatar May 21 '21 11:05 mjf

Hi @nikkhils do you have any news about this, please?

mjf avatar Aug 24 '21 07:08 mjf

@cevian can you help out here?

NunoFilipeSantos avatar Nov 05 '21 12:11 NunoFilipeSantos

I'll have to look at the semantics Grafana expects (inclusive or exclusive). Not sure which is right here. @svenklemm originally wrote the DS so he may be able to help here as well.

cevian avatar Nov 05 '21 13:11 cevian

I think you want lower inclusive and upper exclusive. Upper inclusive and lower exclusive would work too but might be a little weird since time_bucket returns lower. Currently it does both inclusive which leads to double counting if values are exactly on the boundary. If you were to switch to both exclusive that would lead to missing counts for values that are exactly on boundary.

svenklemm avatar Nov 08 '21 00:11 svenklemm

@nikkhils, @svenklemm, @cevian Hi guys, any update on this, please?

mjf avatar Jan 13 '22 10:01 mjf