Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 1C6D063232F for ; Fri, 6 Aug 2010 12:43:45 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 24959-04 for ; Fri, 6 Aug 2010 15:43:37 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from spinlock.commandprompt.com (host-215.commandprompt.net [207.173.203.215]) by mail.postgresql.org (Postfix) with ESMTP id 9F54E632C3F for ; Fri, 6 Aug 2010 12:43:37 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by spinlock.commandprompt.com (Postfix) with ESMTP id 43E0534803A; Fri, 6 Aug 2010 08:43:36 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at commandprompt.com Received: from spinlock.commandprompt.com ([127.0.0.1]) by localhost (spinlock.commandprompt.com.commandprompt.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vadl0e5qoQWK; Fri, 6 Aug 2010 08:43:34 -0700 (PDT) Received: from perhan.alvh.no-ip.org (190-95-29-207.bk17-dsl.surnet.cl [190.95.29.207]) by spinlock.commandprompt.com (Postfix) with ESMTPSA id BCEEE348038; Fri, 6 Aug 2010 08:43:33 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 9DDBF6E607; Fri, 6 Aug 2010 11:43:31 -0400 (CLT) Content-Type: text/plain; charset=UTF-8 Cc: pgsql-admin Subject: Re: out of memory error From: Alvaro Herrera To: Silvio Brandani In-reply-to: <4C5BF885.9060105@tech.sdb.it> References: <288793.40690.qm@web39707.mail.mud.yahoo.com> <4C5BC43B.7050503@tech.sdb.it> <4C5BF885.9060105@tech.sdb.it> Date: Fri, 06 Aug 2010 11:43:31 -0400 Message-Id: <1281109308-sup-669@alvh.no-ip.org> User-Agent: Sup/git Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.5 tagged_above=-10 required=5 tests=BAYES_05=-0.5 X-Spam-Level: X-Archive-Number: 201008/45 X-Sequence-Number: 35294 Excerpts from Silvio Brandani's message of vie ago 06 07:56:53 -0400 2010: > it seems the execution plan is different for this query when run from > the application versus the psql . How can I check the execution plan of > a query run by a user?? > I can set explain analyze for the query via psql but how can I check > with application running the query??? If this is a prepared query, then that is a good guess. You can see the real plan that the application is getting in psql by explaining the execution of a prepared statement like this: PREPARE foo(int, text) AS SELECT blah FROM foo, bar WHERE foo.id = $1 AND ... EXPLAIN ANALYZE EXECUTE foo(someval, another); -- Álvaro Herrera The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support