Re: View performance with implicit cast - Mailing list pgsql-sql

From Tom Lane
Subject Re: View performance with implicit cast
Date
Msg-id 640397.1736015849@sss.pgh.pa.us
Whole thread Raw
In response to View performance with implicit cast  (Tomasz Szypowski <tomasz.szypowski@asseco.pl>)
Responses RE: View performance with implicit cast
List pgsql-sql
Tomasz Szypowski <tomasz.szypowski@asseco.pl> writes:
> I have got an example, in which PostgreSQL could speed up:

The reason why the first version of the view doesn't behave well
is that it's not optimized into an "append relation", because
is_simple_union_all() doesn't think that's safe:

/*
 * is_simple_union_all
 *      Check a subquery to see if it's a simple UNION ALL.
 *
 * We require all the setops to be UNION ALL (no mixing) and there can't be
 * any datatype coercions involved, ie, all the leaf queries must emit the
 * same datatypes.
 */

Perhaps this could be improved, but it's a lot easier just to add
the cast yourself.

            regards, tom lane



pgsql-sql by date:

Previous
From: Tomasz Szypowski
Date:
Subject: View performance with implicit cast
Next
From: Tomasz Szypowski
Date:
Subject: RE: View performance with implicit cast