X-Original-To: pgsql-admin@postgresql.org Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id DCE7547631B for ; Thu, 13 Mar 2003 19:58:14 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.8/8.12.8) with ESMTP id h2E0wFub013992; Thu, 13 Mar 2003 19:58:15 -0500 (EST) To: Stephan Szabo Cc: Chris Mungall , pgsql-admin@postgresql.org Subject: Re: Using functions as filters in queries In-reply-to: <20030312140421.O56401-100000@megazone23.bigpanda.com> References: <20030312140421.O56401-100000@megazone23.bigpanda.com> Comments: In-reply-to Stephan Szabo message dated "Wed, 12 Mar 2003 14:10:41 -0800" Date: Thu, 13 Mar 2003 19:58:14 -0500 Message-ID: <13991.1047603494@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200303/203 X-Sequence-Number: 7843 Stephan Szabo writes: > Of course, I misread what explain did (without trying the > enable_seqscan=off case) and this is still not indexable because even > after that, you'll not get a clause on the outside that it considers > indexable. It is smart enough (7.4 anyway) to make the filter ((t.*).n)=5 > which I thought it'd index, but doesn't. :( As of a few moments ago, CVS tip reduces that to t.n=5 which is indexable. regression=# EXPLAIN select * from t where f(t, 5) AND x like 'a%'; QUERY PLAN -------------------------------------------------------------- Index Scan using ti on t (cost=0.00..17.08 rows=1 width=38) Index Cond: (n = 5) Filter: (x ~~ 'a%'::text) (3 rows) regards, tom lane