autovacuum vacuum creates bad statistics for planner when it log index scans: 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On a 9.3.1 server , I have a key busy_table in that is hit by most
transactions running on our system. One DB's copy of this table has 60K rows
and 1/3 of that tables rows can updated every minute.

Autovacuum autovacuum_analyze_scale_factor is set 0.02, so that analyse runs
nearly every minute. But when autovacuum vacuum runs I sometimes see the
following message in logs:

LOG:  automatic vacuum of table "busy_table":* index scans: 0*
        pages: 0 removed, 22152 remain
        tuples: 0 removed, 196927 remain
        buffer usage: 46241 hits, 478 misses, 715 dirtied
        avg read rate: 0.561 MB/s, avg write rate: 0.839 MB/s
        system usage: CPU 0.07s/0.06u sec elapsed 6.66 sec

and the tuples remaining is then overestimated by a factor >3 , and have
seen this over estimate as large at >20 times IE 5M

This causes the query planner to then fail to get the best plan, in fact
this can result in queries that take 30 Minutes that normally  return in 4-6
seconds.

IE it starts table scanning tables in joins to busy_table rather than using
the index.

As soon as following appears:
LOG:  automatic vacuum of table "busy_table": *index scans: 1*

all is well again for the queries that follow this , but for the 20-30 user
interactions during the bad period never return as they take too long.




--
View this message in context: http://postgresql.1045698.n5.nabble.com/autovacuum-vacuum-creates-bad-statistics-for-planner-when-it-log-index-scans-0-tp5804416.html
Sent from the PostgreSQL - performance mailing list archive at Nabble.com.



[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux