X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 79739D1B18C for ; Sat, 5 Jun 2004 16:01:51 -0300 (ADT) 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 48461-05 for ; Sat, 5 Jun 2004 19:01:44 +0000 (GMT) Received: from stan.aopsys.com (aopsysadsl.net1.nerim.net [62.212.101.94]) by svr1.postgresql.org (Postfix) with ESMTP id 7A3BAD1B17C for ; Sat, 5 Jun 2004 16:01:41 -0300 (ADT) Received: from [127.0.0.1] (helo=localhost) by stan.aopsys.com with esmtp (Exim 4.30) id 1BWgQ6-0003U0-2P; Sat, 05 Jun 2004 21:01:30 +0200 To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: Unused table of view References: <87y8n2t6jd.fsf@stan.aopsys.com> <24845.1086456990@sss.pgh.pa.us> From: Laurent Martelli Organization: AOPSYS Date: Sat, 05 Jun 2004 21:01:29 +0200 In-Reply-To: <24845.1086456990@sss.pgh.pa.us> (Tom Lane's message of "Sat, 05 Jun 2004 13:36:30 -0400") Message-ID: <87u0xpu8vq.fsf@stan.aopsys.com> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/20.7 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/46 X-Sequence-Number: 7104 >>>>> "Tom" == Tom Lane writes: Tom> Laurent Martelli writes: >> The pictures table is scanned, but it's not needed. Tom> Yes it is. For example, if pictures is empty then the view Tom> yields zero rows. Omitting the join to pictures could give a Tom> different result. Since Permission is like this: CREATE TABLE permissions ( GroupID integer NOT NULL REFERENCES groups ON DELETE cascade, PictureID integer NOT NULL REFERENCES pictures ON DELETE cascade, UNIQUE (GroupID, PictureID)); if the pictures table is empty, so is permissions, because permissions.PictureID references pictures. -- Laurent Martelli laurent@aopsys.com Java Aspect Components http://www.aopsys.com/ http://jac.objectweb.org