Result order for GROUP BY

#1

Is the order of the groups returned in a GROUP BY query deterministic? For instance, is it always alphabetical according to tag key and value?

I’m looking for ways to optimise some large queries across multiple measurements. The measurements have the same tag schema, and as I’m parsing two result sets for two measurements in parallel, I could pair up results that have the same tag values. This will only work if I know the groups are returned in the same order on both measurements… it’s no good if measurement1 returns Tag1=A…Z and measurement2 returns Tag2=Z…A.

(Note that I’m not using Kapacitor, this is a custom application that parses result set JSON directly.)

#2

Hi! Yes, GROUP_BY is deterministic by tag name, so they should be returned in the same order.