Re: Unused table of view - Mailing list pgsql-performance

From Laurent Martelli
Subject Re: Unused table of view
Date
Msg-id 87u0xpu8vq.fsf@stan.aopsys.com
Whole thread Raw
In response to Re: Unused table of view  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:

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


pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Unused table of view
Next
From: Steve Wampler
Date:
Subject: Using a COPY...FROM through JDBC?