SortSupport: Sorting in Postgres at Speed
These tuples have space for a value the size of a native pointer (i.e. 64 bits on a 64-bit machine) which is enough to fit the entirety of some common types like booleans or integers (known as pass-by-value types), but not for others that are larger than 64 bits or arbitrarily large. It stores entire values for pass-by-value types, abbreviated keys for pass-by-reference types that implement SortSupport, and a pointer for those that don’t. Here you can see the conversion routine adding new values to the HyperLogLog if an abort is still possible:
And where it makes an abort decision (from ):
It also covers aborting the case where we have a data set that’s poorly suited to the abbreviated key format.
Source: brandur.org