Re: Slow Inserts on 1 table? - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Slow Inserts on 1 table?
Date
Msg-id 20050802171059.GB13018@svana.org
Whole thread Raw
In response to Re: Slow Inserts on 1 table?  (Dan Armbrust <daniel.armbrust.list@gmail.com>)
List 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@svana.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.

Attachment

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Problem with dropping a tablespace
Next
From: Richard Huxton
Date:
Subject: Re: Unable to Update a Record