Re: Querying all documents for a company and its projects etc

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Querying all documents for a company and its projects etc
Date: 2014-04-14 19:55:26
Message-ID: 1397505326009-5799978.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

A couple of thoughts:

1) The "union" really only pertains to the entity table rows; once you
"union all" those (duplicates should not matter and probably will not even
be present so using "all" avoids an unnecessary sort) you can join that
sub-query to the document_usage table.

2) Since every entity must have an associated company moving the company_id
field to the entity table will allow a direct search for company objects
using entity alone and remove the need to perform the union. The "company"
table omits the implicit self-referencing company_id but it is still there
in reality.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Querying-all-documents-for-a-company-and-its-projects-etc-tp5799967p5799978.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vincent Veyron 2014-04-14 21:35:53 Re: Approach to Data Summary and Analysis
Previous Message Adrian Klaver 2014-04-14 19:54:37 Re: lpgport issue while installing pg_bulkload utility on fedora 14 OS