Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TZO3C-0004Is-FD for pgsql-performance@postgresql.org; Fri, 16 Nov 2012 15:41:50 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TZO3A-0003tB-Nn for pgsql-performance@postgresql.org; Fri, 16 Nov 2012 15:41:50 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id qAGFfkkM015098; Fri, 16 Nov 2012 10:41:46 -0500 (EST) From: Tom Lane To: Russell Keane cc: "pgsql-performance@postgresql.org" Subject: Re: intercepting where clause on a view or other performance tweak In-reply-to: <8D0E5D045E36124A8F1DDDB463D548557D0CDC68C0@mxsvr1.is.inps.co.uk> References: <8D0E5D045E36124A8F1DDDB463D548557D0CDC68A8@mxsvr1.is.inps.co.uk> <14368.1353078307@sss.pgh.pa.us> <8D0E5D045E36124A8F1DDDB463D548557D0CDC68C0@mxsvr1.is.inps.co.uk> Comments: In-reply-to Russell Keane message dated "Fri, 16 Nov 2012 15:17:42 +0000" Date: Fri, 16 Nov 2012 10:41:45 -0500 Message-ID: <15097.1353080505@sss.pgh.pa.us> X-Pg-Spam-Score: -2.0 (--) X-Archive-Number: 201211/188 X-Sequence-Number: 48554 Russell Keane writes: > Sorry, I should've added that in the original description. > I have an index on search_key and it's never used. Did you pay attention to the point about the nondefault operator class? If the LIKE pattern is left-anchored and as selective as your example implies, the planner certainly ought to try to use a compatible index. regards, tom lane