3 ms·
> A note about count(1) vs count(). One might think that count(1) would be faster because count() appears to consult the data for a whole row. However the oppos
by tosh 6y ago
> A note about count(1) vs count(). One might think that count(1) would be faster because count() appears to consult the data for a whole row. However the opposite is true. The star symbol is meaningless here, unlike its use in SELECT . PostgreSQL parses The expression count() as a special case taking no arguments. (Historically the expression ought to have been defined as count().) On the other hand count(1) takes an argument and PostgreSQL has to check at every row to see that ts argument, 1, is indeed still not NULL.