Re: Slow Inserts on 1 table?

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Dan Armbrust <daniel(dot)armbrust(dot)list(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Slow Inserts on 1 table?
Date: 2005-08-02 17:10:59
Message-ID: 20050802171059.GB13018@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Aug 02, 2005 at 10:41:01AM -0500, Dan Armbrust wrote:
> But it is rather easy to get into rant mode when the prevailing
> opinion is that not being able to insert rows into a table with a
> foreign key without running Analyze after X rows is a misuse of the
> DB, rather than a bug.

I havn't seen it in this thread but it reminds me of someone who had a
similar problem a long time ago. Basically, he was doing:

TRUNCATE
ANALYZE
<load database>

This screwed everything up, because the ANALYZE set the statistics to
zero size tables. The solution was: *Don't* analyze the table when it's
empty. If he left out the ANALYZE altogether it worked.

It also works because just after a CREATE TABLE it defaults to using
indexes too.

The *only* time it starts worrying about seq scans is if you run ANALYZE
on an empty table. So don't do that.

Hope this helps,

--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jaime Casanova 2005-08-02 17:19:25 Re: [BUGS] BUG #1552 followup
Previous Message Tom Lane 2005-08-02 17:05:33 Re: Problem with dropping a tablespace