Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TxlpC-0000n0-2W for pgsql-admin@arkaria.postgresql.org; Tue, 22 Jan 2013 21:56:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TxlpB-0004Z1-84 for pgsql-admin@arkaria.postgresql.org; Tue, 22 Jan 2013 21:56:09 +0000 Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TxlpA-0004Yw-Iv for pgsql-admin@postgresql.org; Tue, 22 Jan 2013 21:56:08 +0000 Received: from mout.gmx.net ([74.208.4.200]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Txlp8-0007ih-4G for pgsql-admin@postgresql.org; Tue, 22 Jan 2013 21:56:08 +0000 Received: from mailout-us.gmx.com ([172.19.198.46]) by mrigmx.server.lan (mrigmxus002) with ESMTP (Nemesis) id 0LedIY-1T7hoA3IAY-00qT34 for ; Tue, 22 Jan 2013 22:56:04 +0100 Received: (qmail 16003 invoked by uid 0); 22 Jan 2013 21:56:04 -0000 Received: from 76.255.19.161 by rms-us010 with HTTP Content-Type: text/plain; charset="utf-8" Date: Tue, 22 Jan 2013 16:56:01 -0500 From: "Kevin Grittner" Message-ID: <20130122215601.120610@gmx.com> MIME-Version: 1.0 Subject: Re: Schema design question as it pertains to performance To: "Benjamin Krajmalnik" ,pgsql-admin@postgresql.org X-Authenticated: #138763884 X-Flags: 0001 X-Mailer: GMX.com Web Mailer x-registered: 0 Content-Transfer-Encoding: 8bit X-GMX-UID: pm+NcHlO3zOlOQ09LnwhU3x+IGRvb8Bz X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Benjamin Krajmalnik wrote: > From a performance standpoint, is there a big hit on select performance > if a query ends up utilizing more than one index, taking into account > that an index has been used already to reduce the data set of potential > records, and the secondary index would mostly be used in the ordering of > the result set (such as a last updated time)? That depends on so many variables it is hard to give a simple answer. > I also assume that if no data has changed in an index, nothing is done > when the record is updated as pertains to the particular index - am I > correct in this assumption? No. If the update doesn't affect *any* indexed column, and there is room in the page, it will do a HOT update and can skip all index updates. If any indexed column is updated, it must expire the old tuple and create a new tuple to represent the updated version of the row, and this new tuple is not likely to land in the same page as the old tuple; so it needs new entries in all the indexes. The old index entries must remain until they can no longer be the visible version of the row for any database transaction, so both versions of the row will be on the index for a while. -Kevin -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin