Skip site navigation (1) Skip section navigation (2)

Re: [RESOLVED] INSERT does not finish except if it is carried

From: Matthieu Guamis <matthieu(dot)guamis(at)axege(dot)com>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: [RESOLVED] INSERT does not finish except if it is carried
Date: 2006-09-13 13:50:58
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-generalpgsql-novice
> Are you running autovacuum?
Yes I am, ("autovacuum = on" in postgres.conf).
> You could use EXPLAIN ANALYZE
I'll do it soon.

Thank you very much for the explanation.

Michael Fuhr a écrit :
> On Wed, Sep 13, 2006 at 03:12:22PM +0200, Matthieu Guamis wrote:
>> If I use "VACUUM ANALYSE maTable" after CREATE AS of the DROP/CREATE 
>> AS/INSERT statements then INSERT commits in a few seconds.
>> Documentation says :"VACUUM ANALYZE: Updates statistics used by the 
>> planner to determine the most efficient way to execute a query."
> Are you running autovacuum?  If so then that might explain why the
> query runs faster after waiting a little while.  When you first
> create the table the planner doesn't have good statistics about it
> so it might use a sub-optimal query plan.  After autovacuum runs
> and analyzes the table, the statistics are more accurate and the
> planner uses a better plan.  When you delete rows rather than drop
> and recreate the table, the planner can use statistics based on the
> table's previous contents and choose a good plan right away.  You
> could use EXPLAIN ANALYZE on the problematic SELECT statement to
> see if this is what's happening.

In response to

pgsql-novice by date

Next:From: developer_studentDate: 2006-09-13 14:41:07
Subject: Re: problems connecting remote postgresql server
Previous:From: Michael FuhrDate: 2006-09-13 13:35:14
Subject: Re: [RESOLVED] INSERT does not finish except if it is carried

pgsql-general by date

Next:From: Michael FuhrDate: 2006-09-13 14:29:05
Subject: Re: Template1 oops
Previous:From: didier tantiDate: 2006-09-13 13:46:40
Subject: Load "" error cannot load obj file...

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group