Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id AC7E89FBDA9 for ; Fri, 30 Mar 2007 08:49:36 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 75043-06-2 for ; Fri, 30 Mar 2007 08:49:28 -0300 (ADT) X-Greylist: delayed 00:29:54.674389 by SQLgrey-1.7.4 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id D1F809FBE0E for ; Fri, 30 Mar 2007 08:49:32 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from mi1.bluebottle.com (mi1.bluebottle.com [206.188.25.14]) by svr4.postgresql.org (Postfix) with ESMTP id 57F355AF03F for ; Fri, 30 Mar 2007 11:19:37 +0000 (GMT) Received: from fe0.bluebottle.com (internal.bluebottle.com [206.188.24.43]) by mi1.bluebottle.com (8.13.1/8.13.1) with ESMTP id l2UBJU17012567 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 30 Mar 2007 04:19:30 -0700 DomainKey-Signature: a=rsa-sha1; s=mail; d=bluebottle.com; c=simple; q=dns; h=received:to:message-id:date:from:subject:mime-version: content-type:content-transfer-encoding:user-agent; b=vn4VyX7xGMWyqvyvM64PdbE49fk1gMphpLt/REf7EKk37hC0vWpuW+LF5Sm2RTQ54 b5EeoZrZV3xLBZoUNlygx074tg0h1sv1eOCpz9Dw9/RidkrR+bZ+Mw9zd058Psw Received: from localhost (internal.bluebottle.com [206.188.24.43]) (authenticated bits=0) by fe0.bluebottle.com (8.13.1/8.13.1) with ESMTP id l2UBJU3N002331 for ; Fri, 30 Mar 2007 04:19:30 -0700 Received: from alv-global.enator.se (alv-global.enator.se [193.15.240.60]) by mail.bluebottle.com (IMP) with HTTP for ; Fri, 30 Mar 2007 04:19:30 -0700 To: pgsql-admin@postgresql.org Message-ID: <1175253570.460cf2427984c@mail.bluebottle.com> Date: Fri, 30 Mar 2007 04:19:30 -0700 From: Rickard =?iso-8859-1?b?U2r2c3Ry9m0=?= Subject: Performance on views MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.2 X-Virus-Scanned: ClamAV version 0.88.4, clamav-milter version 0.88.4 on localhost X-Virus-Status: Clean X-Trusted-Delivery: <09258b615e5921621ec7235df868db58> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.143 tagged_above=0 required=5 tests=BAYES_50=0.001, SPF_FAIL=1.142 X-Spam-Level: * X-Archive-Number: 200703/229 X-Sequence-Number: 25053 Hi! I've probably missed somthing but here is my problem. I have a view that is really slow and I ca easily work around the slowness by bypassing the view and query the real table directly. Example: -------------------------------------------- From view, the slow one: SELECT * from my_view WHERE date > 2007-03-01 and to speed it up I just copy the view defintion and inserts some "date > ...", like this. SELECT * FROM (select * from my_table where data > 2007-03-01) mt, my JOIN someother on mt.id=smoeother.id etc,... -------------------------------------------- The thing here is that I limit the query before joining with other data. Did I get through with my problem? Any ideas how I can speed up my views? Is there something I can tell the database in order to speed up? Is this a known issue with views? /Rickard ---------------------------------------------------------------------- Click to lower your debt and consolidate your monthly expenses http://tags.bluebottle.com/fc/CAaCMPJklAkSFsDVLmOtm1fwWle86ZFg/