X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F3C7455CC5 for ; Thu, 3 Mar 2005 15:04:34 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94476-04 for ; Thu, 3 Mar 2005 15:04:30 +0000 (GMT) Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by svr1.postgresql.org (Postfix) with SMTP id AFC1254EF1 for ; Thu, 3 Mar 2005 15:04:28 +0000 (GMT) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Thu Mar 03 16:04:28 2005 +0100 Received: from rodos.fzk.de (resy6.fzk.de [141.52.68.10]) by resy5.fzk.de (8.12.7/8.12.7/SuSE Linux 0.6) with ESMTP id j23F4RsG023672; Thu, 3 Mar 2005 16:04:27 +0100 Message-ID: <4227277A.581C0D6E@rodos.fzk.de> Date: Thu, 03 Mar 2005 16:04:26 +0100 From: Christoph Haller X-Mailer: Mozilla 4.77 [en] (X11; U; HP-UX B.10.20 9000/780) X-Accept-Language: en MIME-Version: 1.0 To: Steffen Boehme Cc: pgsql-sql@postgresql.org Subject: Re: Performance of Views References: <38h2r6F5k5o1dU1@individual.net> Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS - amavis-milter (http://www.amavis.org/) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.03 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/45 X-Sequence-Number: 20524 There is no difference in run-time between a VIEW and executing the underlying SELECT because it's the same. You may move your question to the [PERFORMANCE] list for hints to speed up your query. Regards, Christoph Steffen Boehme wrote: > > Hello there, > > i have a short question ... > > I have a few tables (at the moment "only" 3 for testing), over which > will by made a query in this form: > > SELECT > a.orderitem_id, > a.transaction_id, > a.order_id, > a.shop_id, > a.quantity, > a.price, > b.affiliate_id, > c."type" > FROM > ss_order_orderitems a > LEFT JOIN ss_order_affiliate_tracking b ON a.order_id = b.order_id, > ss_shops c > WHERE > (a.order_id = b.order_id OR b.order_id IS NULL) AND > a.shop_id = c.shop_id; > > The query will get later a few more conditions ... > > Now is the problem, that the performance is not realy good ... and i > think about the best solution for such a query and found three possibilitys: > > 1. a simple select over the three tables (one of them contains 160000 > entrys in the moment and it's growing) in the form like above (the db is > mysql 4.1.x) > I think this solution is not very perfomant ... > > 2. move the data to a postgresql-db with the same structur and create a > view, wich makes the same query ... > Is the performance for the same query different between a simple select > and a view!? > If so, i can forget the view ... > > 3. put the data with the above query in one big table ... > I know, thats no good db-structur, but i don't know how i could make it > better ... > > The main-question at the moment iss ... > Is the performance of the View-Method better then the first Method on > the existing tables!? > > I hope of a view hints ... > > Thanks > Steffen >