PostgreSQL: Ultra Simple COUNT(*) Workaround
Just a little something I whipped up. It’s only for getting the total number of rows in table X. If you have under 10,000 rows, the performance hit of COUNT(*) is neglectable and you probably don’t need this.
Example:
SELECT __count_add('my_table');
SELECT rows FROM __count_tables WHERE tablename = 'my_table';
