Re: Performance issues - Mailing list pgsql-performance

From Jim Nasby
Subject Re: Performance issues
Date
Msg-id 55073272.20209@BlueTreble.com
Whole thread Raw
In response to Re: Performance issues  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Responses Re: Performance issues  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-performance
On 3/13/15 7:12 PM, Tomas Vondra wrote:
> (4) I suspect many of the relations referenced in the views are not
>      actually needed in the query, i.e. the join is performed but
>      then it's just discarded because those columns are not used.
>      Try to simplify the views as much has possible - remove all the
>      tables that are not really necessary to run the query. If two
>      queries need different tables, maybe defining two views is
>      a better approach.

A better alternative with multi-purpose views is to use an outer join
instead of an inner join. With an outer join if you ultimately don't
refer to any of the columns in a particular table Postgres will remove
the table from the query completely.
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com


pgsql-performance by date:

Previous
From: Jim Nasby
Date:
Subject: Re: Best VPS provider for running performant PostgreSQL database server
Next
From: Jim Nasby
Date:
Subject: Re: MusicBrainz postgres performance issues