↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / Functions

bit_count

Returns the number of bits set in the binary string (also known as “popcount”).

English manual coverage begins with PostgreSQL 7.1. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

group
binarystring
group label
Binary String Functions And Operators
lang
en
layout
table-new
pages
functions-binarystring.html, functions-bitstring.html
prose only
false

Definition PG 18

Returns the number of bits set in the binary string (also known as “popcount”).

Signatures and overloads

bit_count ( bytes bytea ) → bigint → bigint
Returns the number of bits set in the binary string (also known as “popcount”).
bit_count ( bit ) → bigint → bigint
Returns the number of bits set in the bit string (also known as “popcount”).

Compare versions

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · wiki-repair-20261023:310495dc3ee1465538d5156095d6e4b5282df710d9d483b78425d260fd6f69a2

Text language: en · wiki-repair-20261023:310495dc3ee1465538d5156095d6e4b5282df710d9d483b78425d260fd6f69a2