Re: Unused table of view

From: Laurent Martelli <laurent(at)aopsys(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Unused table of view
Date: 2004-06-05 19:01:29
Message-ID: 87u0xpu8vq.fsf@stan.aopsys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

Tom> Laurent Martelli <laurent(at)aopsys(dot)com> 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(at)aopsys(dot)com Java Aspect Components
http://www.aopsys.com/ http://jac.objectweb.org

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Steve Wampler 2004-06-05 20:12:29 Using a COPY...FROM through JDBC?
Previous Message Carlos Eduardo Smanioto 2004-06-05 18:55:32 [OFF-TOPIC] - Known maximum size of the PostgreSQL Database