Hi Tom,
Thanks for your reply, that’s very helpful and informative.
Although there's no way to have any useful pg_statistic stats if you won't That appears to be correct. I assumed that because the table was analyzed and found to be empty then the autovacuum would probably have cleared all the tuples too, but that’s not the case.
relpages | reltuples
----------+-------------
0 | 2.33795e+06
I am not following your aversion to sticking an ANALYZE in there, There are many usage profiles for these tables. Sometimes there will be a single insert of 30 million rows, sometimes there will be several inserts of up to 100 million rows each in different threads, sometimes there will be many (~80 000) inserts
of 0 rows (for which an ANALYSE is simply a waste) - I don’t want to cause undue performance penalty on the other usage profiles.
But as Justin rightly points out I can selectively ANALYSE only when > x rows are inserted, which I think is the best way forward.
David Wheeler
Software developer E dwheeler@xxxxxxxxxxxxxxx D +61 3 9663 3554 W http://dgitsystems.com Level 8, 620 Bourke St, Melbourne VIC 3000.
|