From: Dean Gibson (DB Administrator) <postgresql@ultimeth.com>
To: pgsql-performance@postgresql.org
Subject: Re: Q on views and performance
Date: Sat, 23 Feb 2008 08:55:42 -0800
Message-ID: <47C0500E.90907@ultimeth.com> (raw)
In-Reply-To: <47C04E89.3030300@ultimeth.com>
References: <c2350ba40802221249h37913d0cyaa6387a93c55fe69@mail.gmail.com>
<47BF7B80.1040309@ultimeth.com>
<c2350ba40802230559l280eab73k8e79a8bda7a4994a@mail.gmail.com>
<47C03709.5010205@ultimeth.com>
<c2350ba40802230821t2446a151j3279b8ea901c31b3@mail.gmail.com>
<47C04E89.3030300@ultimeth.com>
On 2008-02-23 08:49, Dean Gibson (DB Administrator) wrote:
> Why 10,000 views??? What's wrong with the ONE view above? You DON'T
> want to be defining VIEWs based on actual tables VALUES; leave that
> to the SELECT. For that matter, what's wrong with the final SELECT I
> listed (below)?
>
> SELECT a1.word AS word1, a2.word AS word2
> FROM S JOIN T a1 USING( word )
> LEFT JOIN T a2 USING( zipk )
> WHERE a1.type = <int1> AND a2.type = <int2>;
>
> -- Dean
Amendment: I forgot, that if it's a LEFT JOIN you have to write it as:
SELECT a1.word AS word1, a2.word AS word2
FROM S JOIN T a1 USING( word )
LEFT JOIN T a2 USING( zipk )
WHERE a1.type = <int1> AND (a2.type = <int2> OR a2.type IS NULL);
-- Dean
--
Mail to my list address MUST be sent via the mailing list.
All other mail to my list address will bounce.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: postgresql@ultimeth.com
Subject: Re: Q on views and performance
In-Reply-To: <47C0500E.90907@ultimeth.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox