From ken@scottshill.com Thu Feb 9 01:58:39 2006 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 41D299DC81F for ; Wed, 8 Feb 2006 21:58:39 -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 06557-09 for ; Wed, 8 Feb 2006 21:58:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [204.127.192.81]) by postgresql.org (Postfix) with ESMTP id 7A5549DC816 for ; Wed, 8 Feb 2006 21:58:36 -0400 (AST) Received: from [10.0.1.5] (c-24-20-199-254.hsd1.or.comcast.net[24.20.199.254]) by comcast.net (rwcrmhc11) with SMTP id <20060209015339m1100c4q1ee>; Thu, 9 Feb 2006 01:53:39 +0000 Subject: Column Index vs Record Insert Trade-off? From: Ken Hill Reply-To: ken@scottshill.com To: pgsql-sql@postgresql.org Content-Type: multipart/alternative; boundary="=-GHG+r2JJ1VAsMjMO0A5C" Organization: Scotts Hill Associates, Inc. Date: Wed, 08 Feb 2006 17:53:59 -0800 Message-Id: <1139450040.15713.3.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.052 required=5 tests=[AWL=0.051, HTML_MESSAGE=0.001] X-Spam-Score: 0.052 X-Spam-Level: X-Archive-Number: 200602/90 X-Sequence-Number: 24100 --=-GHG+r2JJ1VAsMjMO0A5C Content-Type: text/plain Content-Transfer-Encoding: 7bit Is there a performance trade-off between column indexes and record inserts? I know that in MS Access there is such a trade-off. This being indexes make SQL queries perform faster at the cost of record insert speed. Put another way, the more column indexes in a table, the slower a record insert in that table performs. Is there a similar trade-off in PostgreSQL? --=-GHG+r2JJ1VAsMjMO0A5C Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit Is there a performance trade-off between column indexes and record inserts?

I know that in MS Access there is such a trade-off. This being indexes make SQL queries perform faster at the cost of record insert speed. Put another way, the more column indexes in a table, the slower a record insert in that table performs.

Is there a similar trade-off in PostgreSQL? --=-GHG+r2JJ1VAsMjMO0A5C-- From dev@archonet.com Thu Feb 9 10:26:02 2006 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9FBAF9DC87B for ; Thu, 9 Feb 2006 06:26:02 -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 07680-04 for ; Thu, 9 Feb 2006 06:26:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id 2E20F9DC851 for ; Thu, 9 Feb 2006 06:25:58 -0400 (AST) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 1BBF5407FEF; Thu, 9 Feb 2006 10:26:00 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id C3F9515EA7; Thu, 9 Feb 2006 10:25:59 +0000 (GMT) Message-ID: <43EB18B7.4060006@archonet.com> Date: Thu, 09 Feb 2006 10:25:59 +0000 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: ken@scottshill.com Cc: pgsql-sql@postgresql.org Subject: Re: Column Index vs Record Insert Trade-off? References: <1139450040.15713.3.camel@localhost.localdomain> In-Reply-To: <1139450040.15713.3.camel@localhost.localdomain> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.116 required=5 tests=[AWL=0.116] X-Spam-Score: 0.116 X-Spam-Level: X-Archive-Number: 200602/98 X-Sequence-Number: 24108 Ken Hill wrote: > Is there a performance trade-off between column indexes and record > inserts? > > I know that in MS Access there is such a trade-off. This being indexes > make SQL queries perform faster at the cost of record insert speed. Put > another way, the more column indexes in a table, the slower a record > insert in that table performs. > > Is there a similar trade-off in PostgreSQL? The tradeoff is made in every system. The more indexes you have on a table, the more indexes need to be updated when you update/insert/delete rows. So - a unique constraint automatically implies an index in PostgreSQL (it's how it implements its unique checks). Other than that, you should only index those columns where you will want a small number of rows or quick ordering. -- Richard Huxton Archonet Ltd