I have added a preciseCount argument, which defaults to true.
If you need to get a count for a large table and don't require it to be exact, make preciseCount false.
Based on this article: http://www.dbrnd.com/2015/10/postgresql-fast-way-to-find-the-row-count-of-a-table/ , it queries the pg_stat_user_tables to get an approximate count. This should help speed up queries on larger tables.
On some occasions, the approximate count is equal to the exact count, on others I have find it to be unfortunately quite inaccurate.
Please bear in mind that I only have a few months experience with PSQL and Node, so my testing hasn't been extensive.
I have added a preciseCount argument, which defaults to true. If you need to get a count for a large table and don't require it to be exact, make preciseCount false. Based on this article: http://www.dbrnd.com/2015/10/postgresql-fast-way-to-find-the-row-count-of-a-table/ , it queries the pg_stat_user_tables to get an approximate count. This should help speed up queries on larger tables.
On some occasions, the approximate count is equal to the exact count, on others I have find it to be unfortunately quite inaccurate. Please bear in mind that I only have a few months experience with PSQL and Node, so my testing hasn't been extensive.
Thanks for the library!