Re: Union within View vs.Union of Views

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/3/07, Tom Lane wrote:
> "Jeff Larsen" <jlar310@xxxxxxxxx> 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

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux