Re: Almost infinite query -> Different Query Plan when changing where clause value - Mailing list pgsql-performance

From Kevin Grittner
Subject Re: Almost infinite query -> Different Query Plan when changing where clause value
Date
Msg-id 4B7A3F26020000250002F31A@gw.wicourts.gov
Whole thread Raw
Responses Re: Almost infinite query -> Different Query Plan when changing where clause value
List pgsql-performance
lionel duboeuf  wrote:

> I stopped postgresql
> I started postgresql (and as default autovacuum daemon)
> I restored the databases (need to restore 4 databases)
> It seems that after database 1 have been restored, autovacumm
> started on it and has been stopped while restoring database 2.

> Does this kind of error can lead to the query problem ?

I believe it can.  I assume you're talking about restoring something
which was dumped by pg_dump or pg_dumpall?  If so, you don't have
statistics right after the restore.  Autovacuum will try to build
them for you, but that will take a while.  There are also a couple
other hidden performance issues after a restore:

(1)  None of the hint bits are set, so the first read to each tuple
will cause it to be written again with hint bits, so you will have
mysterious bursts of write activity during read-only queries until
all tuples have been read.

(2)  All tuples in the database will have the same, or nearly the
same, xmin (creation transaction number), so at some indeterminate
time in the future, vacuums will trigger for all of your tables at
the same time, probably in the middle of heavy activity.

For all of the above reasons, I use a special postgresql.conf,
optimized for bulk loads, to restore from dumps (or to pipe from
pg_dump to psql).  I turn off autovacuum during the restore, and then
do an explicit VACUUM FREEZE ANALYZE before I consider the restore
complete.  Then I restart with a "normal" postgresql.conf file.  Some
might consider this extreme, but it works for me, an prevents the
kind of problems which generated your post.

-Kevin


pgsql-performance by date:

Previous
From: AI Rumman
Date:
Subject: Re: Why index is not using here?
Next
From: Bruce Momjian
Date:
Subject: Re: Dell PERC H700/H800