Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id DDE186325AB for ; Tue, 5 Jan 2010 01:16:14 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 96919-03 for ; Tue, 5 Jan 2010 05:16:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 285976322B5 for ; Tue, 5 Jan 2010 01:16:04 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o055Fth2028310; Tue, 5 Jan 2010 00:15:55 -0500 (EST) To: Craig Ringer cc: Erik Jones , Robert Haas , =?ISO-8859-1?Q?Keresztury_Bal=E1?= =?ISO-8859-1?Q?zs?= , pgsql-performance@postgresql.org Subject: Re: forced sequential scan when condition has current_user In-reply-to: <4B42A068.103@postnewspapers.com.au> References: <000f01ca8d87$88e71f30$9ab55d90$@hu> <603c8f071001041359u58159c49k10587c7c46424672@mail.gmail.com> <4B42A068.103@postnewspapers.com.au> Comments: In-reply-to Craig Ringer message dated "Tue, 05 Jan 2010 10:14:00 +0800" Date: Tue, 05 Jan 2010 00:15:55 -0500 Message-ID: <28309.1262668555@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.909 tagged_above=-10 required=5 tests=AWL=-1.498, BAYES_00=-2.599, FH_DATE_PAST_20XX=3.188 X-Spam-Level: X-Archive-Number: 201001/40 X-Sequence-Number: 36920 Craig Ringer writes: > Erik Jones wrote: >> current_user() is a stable function and the manual is explicit that the result of stable function can be used in an index scan: > Yes ... but the planner doesn't know the value current_user will return, I think it's got nothing to do with that and everything to do with the fact that he's comparing to a varchar rather than text column ... regards, tom lane