X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CEC289DCAA6 for ; Fri, 10 Feb 2006 16:45:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05045-06 for ; Fri, 10 Feb 2006 16:45:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ns.snowman.net (ns.snowman.net [66.92.160.21]) by postgresql.org (Postfix) with ESMTP id C38789DC8AD for ; Fri, 10 Feb 2006 16:45:52 -0400 (AST) Received: by ns.snowman.net (Postfix, from userid 1000) id E654D17AE6; Fri, 10 Feb 2006 15:46:53 -0500 (EST) Date: Fri, 10 Feb 2006 15:46:53 -0500 From: Stephen Frost To: david drummard Cc: pgsql-admin@postgresql.org Subject: Re: performance question related to pgsql Message-ID: <20060210204653.GH4474@ns.snowman.net> Mail-Followup-To: david drummard , pgsql-admin@postgresql.org References: <9c89e2490602101241i6a182491l53478521f15f7f8d@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="aJ71jK7Pm60ygaWR" Content-Disposition: inline In-Reply-To: <9c89e2490602101241i6a182491l53478521f15f7f8d@mail.gmail.com> X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/2.4.24ns.3.0 (i686) X-Uptime: 15:45:01 up 244 days, 12:54, 12 users, load average: 0.03, 0.07, 0.02 User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200602/112 X-Sequence-Number: 20533 --aJ71jK7Pm60ygaWR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline * david drummard (vijayspam@gmail.com) wrote: > My question is what is the best way to do step (1) so that after the copy is > done, the table is fully indexed and properly balanced and optimized for > query. > Should i create indexes before or after import ? I need to do this in > shortest period of time so that the data is always uptodate. Note that > incremental updates are not possible since almost every row will be changed > in the new file. Create indexes after import, definitely. analyze after indexes have been created. You don't need to vacuum if you're creating a whole new table each time. Remember that if you need to adjust analyze parameters for some reason that you'll need to do that on every table creation as well. Using COPY is a good approach. Not doing incremental updates when most of the rows are changing also makes sense. Thanks, Stephen --aJ71jK7Pm60ygaWR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFD7Pu9rzgMPqB3kigRArthAJ4vgBzbUL/0YbeWu/luVFIGaP43rwCgkkf2 2Y7ADi6UEbhpl8CyDNC2jA8= =WhhZ -----END PGP SIGNATURE----- --aJ71jK7Pm60ygaWR--