Re:PostgreSQL Count(*) Performance Improvements
by stubish on Thursday April 11, 2019 @02:27AM
(#19631671)
Instead of maintaining a single row in a table for the count, you maintain a table containing several rows. Instead of updating the single row, you insert a new row containing a 1 or -1. To get the count, you sum() the table. And you have a process to rollup the rows occasionally. This way you avoid the locks, except for the rollup.
[ Parent
| on HN ]
There are no comments on this comment yet.