parca icon indicating copy to clipboard operation
parca copied to clipboard

Normalize duration and period in FrostDB queries

Open metalmatze opened this issue 2 years ago • 4 comments

Currently, we normalize / calculate the period and duration in Go code: https://github.com/parca-dev/parca/blob/ed90dbeb684186e9cdb295bc0f62c723ed3c5a9f/pkg/parcacol/querier.go#L432-L438

This should ideally happen in the FrostDB query and only return the result to the Parca code. That way the normalization can happen in FrostDB and in a distributed version this can be pushed down into the individual nodes.

metalmatze avatar Feb 15 '23 11:02 metalmatze

We should open an issue in frostdb to add support for binary operations in projections, no? Eg. SELECT sum(period) / count(value) FROM stacktraces;.

brancz avatar Feb 16 '23 08:02 brancz

Matthias, didn't you implement something along those lines already?

asubiotto avatar Feb 16 '23 08:02 asubiotto

I think we never finished it as part of the average work: https://github.com/polarsignals/frostdb/pull/302

The idea was to turn an average aggregation into a sum and count aggregation and push a projection into the resulting query plan that does sum/count. Looks like we just haven't finished it up.

brancz avatar Feb 16 '23 08:02 brancz

Thanks for pointing that other PR out. We should definitely take that as the foundation to support this. :+1:

metalmatze avatar Feb 20 '23 18:02 metalmatze