Track row counts in PostgreSQL