Understanding PostgreSQL COUNT(NULL), COUNT(*), and COUNT(1)

In PostgreSQL, the COUNT function is commonly used to count the number of rows in a table. However, there are subtle differences between COUNT(NULL), COUNT(*), and COUNT(1) that are worth understanding. Let’s delve into each of these variants, their usage, and performance implications.

March 10, 2024 · 2 min · 292 words · Bá Tới