balderdashy/sails-postgresql — pull request #55 by polastre (2014-04-15 23:25:35+00:00)
Title: Implement `count` for postgres

When no count function occurs, the database uses a
find() function to return all rows in the database.
Waterline then emulates the count by counting the
returned rows.

As you can imagine, this is very inefficient. Instead,
when a `count` query is executed, use postgres (sql)
standard count syntax:

SELECT COUNT(*) FROM ...

This can speed up applications significantly since the
count and ids can be indexed.