Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 0985C2E0030 for ; Fri, 23 May 2008 13:35:45 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 82709-02 for ; Fri, 23 May 2008 13:35:24 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from svr2.hagander.net (svr2.hagander.net [88.198.128.226]) by developer.postgresql.org (Postfix) with ESMTP id 7AC982E0037 for ; Fri, 23 May 2008 13:35:25 -0300 (ADT) Received: from dynamic.hagander.net ([127.0.0.1]) (encrypted and authenticated) by svr2.hagander.net (Postfix) with ESMTP id B235ADCCD39; Fri, 23 May 2008 18:35:23 +0200 (CEST) Received: from mha-laptop.hagander.net (localhost [127.0.0.1]) by mha-laptop.hagander.net (Postfix) with ESMTP id DECEDFF0B2; Fri, 23 May 2008 12:35:19 -0400 (EDT) Date: Fri, 23 May 2008 12:35:17 -0400 From: Magnus Hagander To: Jessica Richard Cc: pgsql-performance@postgresql.org Subject: Re: index performance on large tables with update and insert Message-ID: <20080523123517.6305fbde@mha-laptop.hagander.net> In-Reply-To: <334290.54805.qm@web56401.mail.re3.yahoo.com> References: <334290.54805.qm@web56401.mail.re3.yahoo.com> X-Mailer: Claws Mail 3.4.0 (GTK+ 2.12.9; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/321 X-Sequence-Number: 30289 Jessica Richard wrote: > I have a large table with about 2 million rows and it will keep > growing... > > I need to do update/inserts, and select as well. > > An index will speed up the select, but it will slow down the updates. > > Are all Postgres indexes ordered? i.e., with every update, the index > pages will have to be physically reordered? > > Does Postgres have any kind of non-ordered indexes (like Syabse's > non-clustered index)? All PostgreSQL indexes are like the non-clustered ones in Sybase or SQL Server. > What is the common way to take care of the performance issue when you > have to do both update and select on the same large table? Create the indexes you actually need to make the selects and updates fast, just make sure you don't create any unnecessary ones. Usually, your UPDATEs will also require indexes - only the INSERTs actually are losing. //Magnus