Re: View with an outer join - is there any way to optimise - Mailing list pgsql-general

From John McCawley
Subject Re: View with an outer join - is there any way to optimise
Date
Msg-id 439DAF16.5020000@hardgeus.com
Whole thread Raw
In response to Re: View with an outer join - is there any way to optimise  (Rich Doughty <rich@opusvl.com>)
Responses Re: View with an outer join - is there any way to optimise
List pgsql-general
You should be able to use my trick...the join that is giving you the
problem is:

SELECT *
  FROM
      tokens.ta_tokenhist h INNER JOIN
      tokens.vw_tokens    t ON h.token_id = t.token_id
  WHERE
      h.sarreport_id = 9 ;


ta_tokenhist is already part of your view, right?  So you should be able
to include the sarreport_id as part of your view, and then restructure
your query as:


SELECT *
  FROM
      tokens.ta_tokenhist INNER JOIN
      tokens.vw_tokens ON tokens.ta_tokenhist.token_id =
tokens.vw_tokens.token_id
  WHERE
      tokens.vw_tokens.sarreport_id = 9 ;

I removed the aliases because they confuse me ;)



pgsql-general by date:

Previous
From: John McCawley
Date:
Subject: Re: View with an outer join - is there any way to optimise
Next
From: Rich Doughty
Date:
Subject: Re: View with an outer join - is there any way to optimise