X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id C203130EF71 for ; Mon, 16 Jun 2003 22:32:22 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 47778-01 for ; Mon, 16 Jun 2003 19:32:10 -0300 (ADT) Received: from flake.decibel.org (unknown [66.143.173.58]) by svr1.postgresql.org (Postfix) with SMTP id 4842E30EC11 for ; Mon, 16 Jun 2003 19:32:09 -0300 (ADT) Received: (qmail 48006 invoked by uid 1001); 16 Jun 2003 22:32:09 -0000 Date: Mon, 16 Jun 2003 17:32:09 -0500 From: "Jim C. Nasby" To: pgsql-performance@postgresql.org Subject: Re: Partial index where clause not filtering through Message-ID: <20030616223209.GK40542@flake.decibel.org> Reply-To: jim@nasby.net References: <20030616003118.S66185@flake.decibel.org> <26793.1055742214@sss.pgh.pa.us> <20030616012456.U66185@flake.decibel.org> <2619.1055772660@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2619.1055772660@sss.pgh.pa.us> User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD 4.8-RELEASE i386 X-Distributed: Join the Effort! http://www.distributed.net X-Archive-Number: 200306/102 X-Sequence-Number: 2186 On Mon, Jun 16, 2003 at 10:11:00AM -0400, Tom Lane wrote: > "Jim C. Nasby" writes: > > Well, it would only need to make the checks if the table had partial > > indexes. Even then, it probably makes sense to only do the check if > > other query planning steps decide it would be useful to use the partial > > index. > > You have that backwards. Planning is bottom-up, so we have to determine > the relevant indexes *first*. Accordingly, a partial index is a > performance drag on every query that uses its table, as we check to > see if the partial index qual is satisfied by the query's WHERE clause. > That's why I don't want it to be any slower than it is ... Well, could it assume the index was valid until we got to the point where we had to decide what index to use? In other words, don't do the test unless the index appears to be the most attractive one. Also, as I mentioned, if query parsing performance is that important, you can explicitly add whatever clause will show the planner that the index is valid. Also, I just read that there's no statement plan caching, which makes me a bit confused by this todo: Flush cached query plans when their underlying catalog data changes Does that only apply to pl/pgsql? Are there plans to add a statement cache? -- Jim C. Nasby (aka Decibel!) jim@nasby.net Member: Triangle Fraternity, Sports Car Club of America Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?"