Re: Almost infinite query -> Different Query Plan when changing where clause value

From: lionel duboeuf <lionel(dot)duboeuf(at)boozter(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Almost infinite query -> Different Query Plan when changing where clause value
Date: 2010-02-16 10:26:36
Message-ID: 4B7A72DC.4020201@boozter.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Here is my log analysis:
Due to a database recovery task it appears that:

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.

@see log as attached

Here is backup/restore commands i use:

/usr/bin/pg_dump -i -h localhost -U postgres -F c -b -f ... x 4 times

sudo -u postgres pg_restore -d 'database1' x 4 times

Does this kind of error can lead to the query problem ?
If so, what would you suggest me to do to avoid the problem again ?.

Thanks
Lionel

Kevin Grittner a écrit :
> lionel duboeuf wrote:
>
>> Kevin Grittner a écrit :
>>
>
>
>>> I just reread your original email, and I'm not sure I understand
>>> what you meant regarding VACUUM ANALYZE. If you run that right
>>> beforehand, do you still get the slow plan for user 10?
>>>
>
>
>> I confirm by executing manual "VACUUM ANALYZE" that the problem is
>> solved. But what i don't understand is that i would expect
>> autovacuum to do the job.
>>
>
> I think this is the crux of the issue. Boosting the
> default_statistics_target or the statistics target for specific
> columns might help, reducing autovacuum_analyze_scale_factor might
> help, but I can't help wondering whether you inserted a large number
> of rows for user 10 and then ran the query to select user 10 before
> autovacuum had time to complete. Does that seem possible?
>
> -Kevin
>
>

Attachment Content-Type Size
log_postgres text/plain 3.7 KB

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message AI Rumman 2010-02-16 11:43:03 Why index is not using here?
Previous Message lionel duboeuf 2010-02-16 10:26:18 Re: Almost infinite query -> Different Query Plan when changing where clause value