We are going to be using one of the system tables in PostgreSQL to get row count estimates for several tables. I understand that for these estimates to be better, statistics need to be up to date; the wiki here states that one should make sure "you have been running ANALYZE
on the table enough to keep these statistics up to date".
We expect certain tables to eventually be written to or updated quite frequently (say, around a hundred and fifty times a second is my ballpark - this is "quite frequent" to me, but I'm not sure how that qualifies in real-life DB's). Counts should be happening about once every second, and I would say that it would be necessary for them to return a value that reflects the number of rows that changed in the table with some level of accuracy (i.e. it would be strange if the number did not change after a couple of seconds, if there were many inserts over that period).
What is a good value for "enough"? Is there some way to automate the running of ANALYZE
on the tables? If more information is needed, please say so and I'll edit the post ASAP.
Thank you very much!