Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id DC8929FA086 for ; Fri, 6 Oct 2006 16:17:01 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 13293-01-9 for ; Fri, 6 Oct 2006 16:16:59 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.187]) by postgresql.org (Postfix) with ESMTP id 38E0B9FB5CF for ; Fri, 6 Oct 2006 15:53:37 -0300 (ADT) Received: by nf-out-0910.google.com with SMTP id i2so217872nfe for ; Fri, 06 Oct 2006 11:53:35 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=cCSRNS/bjexgfib48OLoXkkI/LyMd3svDBjpE4XuegvwjCPssTJoIJA58chtK+5jaFSShCleZt6TYs4TZ3rneV7DRWBagh69PSOKNslak5gABHxeAPf+VnDCaMERM9lr5p6uwLkd/jFphv+Ffq38tJpm2bUT4WAAVNB4hy8AVNw= Received: by 10.78.128.15 with SMTP id a15mr2054942hud; Fri, 06 Oct 2006 11:53:35 -0700 (PDT) Received: by 10.78.35.18 with HTTP; Fri, 6 Oct 2006 11:53:35 -0700 (PDT) Message-ID: Date: Fri, 6 Oct 2006 14:53:35 -0400 From: "Merlin Moncure" To: "Scott Marlowe" Subject: Re: Performance Optimization for Dummies 2 - the SQL Cc: "Carlo Stonebanks" , pgsql-performance@postgresql.org In-Reply-To: <1160153623.6181.13.camel@state.g2switchworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1160153623.6181.13.camel@state.g2switchworks.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.261 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, SPF_PASS X-Spam-Level: X-Archive-Number: 200610/137 X-Sequence-Number: 21266 On 10/6/06, Scott Marlowe wrote: > On Fri, 2006-10-06 at 11:44, Carlo Stonebanks wrote: > > This didn't work right away, but DID work after running a VACUUM FULL. In > > other words, i was still stuck with a sequential scan until after the > > vacuum. > > > > I turned autovacuum off in order to help with the import, but was perfoming > > an ANALYZE with every 500 rows imported. how did you determine that it is done every 500 rows? this is the default autovacuum paramater. if you followed my earlier recommendations, you are aware that autovacuum (which also analyzes) is not running during bulk inserts, right? imo, best way to do big data import/conversion is to: 1. turn off all extra features, like stats, logs, etc 2. use copy interface to load data into scratch tables with probably all text fields 3. analyze (just once) 4. use big queries to transform, normalize, etc 5. drop scratch tables 6. set up postgresql.conf for production use, fsync, stats, etc important feature of analyze is to tell the planner approx. how big the tables are. merlin