
Since earlier this year there's been a pg_popcount() optimized for AVX-512 :
"Optimize pg_popcount() with AVX-512 instructions.
Presently, pg_popcount() processes data in 32-bit or 64-bit chunks when possible. Newer hardware that supports AVX-512 instructions can use 512-bit chunks, which provides a nice speedup, especially for larger buffers. This commit introduces the infrastructure required to detect compiler and CPU support for the required AVX-512 intrinsic functions, and it adds a new pg_popcount() implementation that uses these functions. If CPU support for this optimized implementation is detected at runtime, a function pointer is updated so that it is used by subsequent calls to pg_popcount()."
Intel has published a technical paper exploring that PostgreSQL AVX-512 optimized pop count implementation. Intel engineers found as much as a 46~48% performance improvement with PostgreSQL's bit_count() function. Here is the Intel finding over AVX-512 gains for PostgreSQL bit counting on their Xeon processors on-premise and in the cloud:
Those wanting to learn more about Intel's findings around this initial AVX-512 usage for PostgreSQL can find the paper on Intel.com .
In case you missed it PostgreSQL this summer also rolled out up to 4x query performance with SIMD-optimized JSON escaping .
Separately there is also a proposal from Intel for AVX-512 CRC32C usage within PostgreSQL.
It's great seeing continued new areas where AVX-512 is paying nice dividends for performance from speedy JSON parsing to databases.
PostgrSQL 17 with this AVX-512 bit counting and many other new features is currently up to its release candidate phase. PostgreSQL 17.0 stable should be out as soon as later this month.