bit_count ( bytes bytea ) → bigintReturns the number of bits set in the binary string (also known as “popcount”).
bit_count('\x1234567890'::bytea) → 15Functions / Binary String Functions And Operators
Returns the number of bits set in the binary string (also known as “popcount”).
Reading PG 18current·documented in 7 of 27 versions, 14 to 20
bit_count ( bytes bytea ) → bigintReturns the number of bits set in the binary string (also known as “popcount”).
bit_count('\x1234567890'::bytea) → 15bit_count ( bit ) → bigintReturns the number of bits set in the bit string (also known as “popcount”).
bit_count(B'10111') → 4
Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source