Re: Slow planning time

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

 



Scott Neville <scott.neville@xxxxxxxxxxxxxxxxxxxxxxx> writes:
> We have a database that for some reason has started to be really slow at planning all queries.  The database is running version 9.4.2 since July 28th (it was freshly installed then - compiled from source).  The response time is fairly sporadic, but the quickest plan time I have seen (on any query) using explain analyze is 39ms with an execution time of 1ms, however we have slow query logging on and we are getting queries taking over 6000 ms in the planning stage with then only a few ms to execute.  There is nothing complex about the queries so even something like this:
> select max(datetime) from audit;
> (where datetime is an indexed field takes 200ms to plan and 0.5ms to execute).

> The databases are involved in a replication chain so I have
> M1 -> S1 -> S2
> I have restarted S2 and S1 and this appears to have made the problem go away (though for how long....).  S1 has a replication slot listed on M1.

Please clarify: the slowness occurs on the slaves but not the master?

I am suspicious that the problem has to do with bloat in pg_statistic,
which I will bet that your homegrown vacuuming protocol isn't covering
adequately.  I concur with Kevin's nearby advice that you'd be better
off to forget that and use 10 or so autovacuum workers; you can use
autovacuum_cost_limit to throttle their I/O impact, and still be a
lot better off than with just 1 worker.

There is probably something else going on that's replication-specific,
but I'm not sufficiently up on that aspect of things to theorize.

			regards, tom lane


-- 
Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux