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