X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 60211D1B513 for ; Fri, 3 Oct 2003 17:18:05 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 99454-01 for ; Fri, 3 Oct 2003 14:17:20 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 29BBCD1B53C for ; Fri, 3 Oct 2003 14:17:19 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h93HHHhn028178; Fri, 3 Oct 2003 13:17:17 -0400 (EDT) To: Jeff Boes Cc: pgsql-admin@postgresql.org Subject: Re: Partial indexes ... any good theoretical discussion? In-reply-to: References: Comments: In-reply-to Jeff Boes message dated "Fri, 03 Oct 2003 16:34:48 +0000" Date: Fri, 03 Oct 2003 13:17:17 -0400 Message-ID: <28177.1065201437@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/46 X-Sequence-Number: 10607 Jeff Boes writes: > If I created the index as something like: > CREATE INDEX ix_foo ON foo(the_date) > WHERE the_date >= now() - interval '24 hours'; > what might I expect as the impact? You won't be allowed to, because now() isn't immutable, and only immutable functions are allowed in index expressions and predicates. You could imagine a batch job every night creating a new index CREATE INDEX ix_foo_20031003 ON foo(the_date) WHERE the_date >= '2003-10-03' and then dropping the prior index. Dunno if this would be worth the trouble, but it might be. The CREATE INDEX should run quite quickly if it only has to pick up a few rows, which it would if you run it shortly after the chosen boundary. > And, absent pat answers to this, is there anything out there in PG-land > that documents partial indexes, and when to use them? http://developer.postgresql.org/docs/postgres/indexes-partial.html The links at the bottom of the page point to various academic papers (I hope the links all still work...) regards, tom lane