Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 31EE41337B49 for ; Sun, 6 Feb 2011 09:21:56 -0400 (AST) 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 19844-02 for ; Sun, 6 Feb 2011 13:21:50 +0000 (UTC) X-Greylist: delayed 00:05:56.894249 by SQLgrey-1.7.6 Received: from brublucs01.mactelecom.net (brublucs01.mactelecom.net [217.64.240.242]) by mail.postgresql.org (Postfix) with ESMTP id CA99C1336B42 for ; Sun, 6 Feb 2011 09:21:48 -0400 (AST) Received: by brublucs01.mactelecom.net (Postfix, from userid 500) id 09574F6477; Sun, 6 Feb 2011 13:15:49 +0000 (UTC) Received: from smtp.eurofer.be (217.64.254.218.mactelecom.net [217.64.254.218]) by brublucs01.mactelecom.net (Postfix) with ESMTP id 9B57EF6472 for ; Sun, 6 Feb 2011 13:15:48 +0000 (UTC) Received: from [192.168.5.10] by smtp.eurofer.be with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1Pm4Sv-0000Mk-Of for pgsql-admin@postgresql.org; Sun, 06 Feb 2011 14:15:49 +0100 From: Guy Deleeuw To: "pgsql-admin@postgresql.org" Content-Type: multipart/alternative; boundary="=-CmoDIiFecGk3V0SrQ6e5" Date: Sun, 06 Feb 2011 14:15:44 +0100 Message-ID: <1296998144.2024.14.camel@pc-1000> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 X-Spam_score: -3.7 X-SA-Exim-Connect-IP: 192.168.5.10 X-SA-Exim-Mail-From: G.De_Leeuw@eurofer.be Subject: How to X-SA-Exim-Scanned: Yes (on smtp.eurofer.be) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201102/24 X-Sequence-Number: 36663 --=-CmoDIiFecGk3V0SrQ6e5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Hello I have a strange behaviour : time psql -d db_cathline -c "SELECT * FROM v_stock_status;" real 0m5.780s user 0m0.090s sys 0m0.020s time psql -d db_cathline -c "SELECT * FROM v_stock_status WHERE remain_qty != 0;" real 0m56.075s user 0m0.070s sys 0m0.030s Why with the clause WHERE the time are 10x greater than ? How can I work around this ? # select version(); version ------------------------------------------------------------------------------------------------------------- PostgreSQL 8.4.7 on x86_64-pc-linux-gnu, compiled by GCC gcc-4.4.real (Ubuntu 4.4.3-4ubuntu5) 4.4.3, 64-bit (1 ligne) Regards Guy --=-CmoDIiFecGk3V0SrQ6e5 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 7bit Hello

I have a strange behaviour :
time psql -d db_cathline -c "SELECT * FROM v_stock_status;"

real 0m5.780s
user 0m0.090s
sys 0m0.020s

time psql -d db_cathline -c "SELECT * FROM v_stock_status WHERE remain_qty != 0;"

real 0m56.075s
user 0m0.070s
sys 0m0.030s

Why with the clause WHERE the time are 10x greater than ? How can I work around this ?

# select version();
                                                   version                                                  
-------------------------------------------------------------------------------------------------------------
PostgreSQL 8.4.7 on x86_64-pc-linux-gnu, compiled by GCC gcc-4.4.real (Ubuntu 4.4.3-4ubuntu5) 4.4.3, 64-bit
(1 ligne)

Regards
Guy

--=-CmoDIiFecGk3V0SrQ6e5--