Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id C8FED632B36 for ; Mon, 22 Feb 2010 15:43:49 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 19559-02 for ; Mon, 22 Feb 2010 19:43:39 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from 30.mail-out.ovh.net (30.mail-out.ovh.net [213.186.62.213]) by mail.postgresql.org (Postfix) with SMTP id A90B563225A for ; Mon, 22 Feb 2010 15:43:38 -0400 (AST) Received: (qmail 32431 invoked by uid 503); 22 Feb 2010 19:48:04 -0000 Received: from b9.ovh.net (HELO mail635.ha.ovh.net) (213.186.33.59) by 30.mail-out.ovh.net with SMTP; 22 Feb 2010 19:48:04 -0000 Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 22 Feb 2010 19:43:41 -0000 Received: from par69-8-88-161-102-87.fbx.proxad.net (HELO localhost) (lists%peufeu.com@88.161.102.87) by ns0.ovh.net with SMTP; 22 Feb 2010 19:43:39 -0000 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Joel Jacobson" , pgsql-performance@postgresql.org Subject: Re: plpgsql plan cache References: <38E2265E-B38E-4EBD-BB87-23B46EF4FD1C@gluefinance.com> Date: Mon, 22 Feb 2010 20:42:44 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Pierre C" Message-ID: In-Reply-To: <38E2265E-B38E-4EBD-BB87-23B46EF4FD1C@gluefinance.com> User-Agent: Opera Mail/10.10 (Linux) X-Ovh-Tracer-Id: 16026903699828835929 X-Ovh-Remote: 88.161.102.87 (par69-8-88-161-102-87.fbx.proxad.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|U 0.5/N X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/301 X-Sequence-Number: 37722 > I cannot understand why the index is not being used when in the plpgsql > function? > I even tried to make a test function containing nothing more than the > single query. Still the index is not being used. > When running the same query in the sql prompt, the index is in use > though. Please post the following : - EXPLAIN ANALYZE your query directly in psql - PREPARE testq AS your query - EXPLAIN ANALYZE EXECUTE testq( your parameters )