What database are you talking about? In what database? When speaking of performance it is difficult to make definitive assertions. It may change according to the implementation, so SQL Server can do one thing and PostgreSQL give another. It can change from one version to another, it can change according to the configuration of that bank or the whole system. It may vary according to the data stored. Performance depends on the implementation detail.
If the database optimizer thinks it should be exactly the same.
Note that the syntax there is very simple. In more complex queries ( JOIN
) may not even give the expected result when using COUNT(1)
. Otherwise the fact of having a constant in place of all fields will not differ because the count will be made on all lines that pass through the filter.
You have a excellent answer about this in the OS .