From: Jeff Larsen <jlar310@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re: Union within View vs.Union of Views
Date: Sun, 4 Nov 2007 04:11:02 -0600
Message-ID: <d1f9b6f00711040211g752cbf2he3488cf62c622193@mail.gmail.com> (raw)
In-Reply-To: <3606.1194141646@sss.pgh.pa.us>
References: <d1f9b6f00711031322h1d2858d4xbfff4852941d405b@mail.gmail.com>
<472CFE4B.5060606@enterprisedb.com>
<3248.1194140315@sss.pgh.pa.us>
<d1f9b6f00711031852k1c7fd695s9874b9966fd8bba1@mail.gmail.com>
<3606.1194141646@sss.pgh.pa.us>
On 11/3/07, Tom Lane wrote:
> "Jeff Larsen" <jlar310@gmail.com> writes:
> > My case probably fits the 'special case' description. Not all the
> > columns in each subquery matched up, so there were NULL::text
> > placeholders in some spots in the SELECT. In the case where
> > performance got bad, one of those columns was included in the
> > application's WHERE clause.
>
> Please see if explicitly casting the nulls to the same datatype as the
> other items they're unioned with makes it go fast. It sounds like you
> are hitting the "no type coercions" restriction.
Sure enough, explicitly casting to exactly the same type for each
column did the trick. In fact the union within the view now has a
slight edge over the union of views.
Thanks,
Jeff
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: jlar310@gmail.com
Subject: Re: Union within View vs.Union of Views
In-Reply-To: <d1f9b6f00711040211g752cbf2he3488cf62c622193@mail.gmail.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