Re: Performance problem with UNION ALL view and domains

From: "Jeff Larsen" <jlar310(at)gmail(dot)com>
To: "Dean Rasheed" <dean_rasheed(at)hotmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Performance problem with UNION ALL view and domains
Date: 2007-11-23 16:29:07
Message-ID: d1f9b6f00711230829q6bbc89b0gf1ed9465dd7daab@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Nov 23, 2007 7:29 AM, Dean Rasheed <dean_rasheed(at)hotmail(dot)com> wrote:
> I am having a performance problem trying to query a view which is a
> UNION ALL of 2 tables. I have narrowed the problem down to my use of
> DOMAINS in the underlying table. So in the test-case below, when the
> column "a" is of domain type foo_text, the query runs slowly using
> the following plan:

I don't know much about DOMAINS, but I did learn somethings about
views, unions and where conditions when I posted a similar performance
question. The best answer was, of course, from Tom Lane here:

http://archives.postgresql.org/pgsql-performance/2007-11/msg00041.php

In my case, the data types in each segment of the union were not
originally identical, preventing the planner from efficiently pushing
the qualifications down to the individual segments prior to the union.

In your case the use of a DOMAIN type may be one of those 'special
cases' forcing the planner to perform the union first, then apply the
conditions.

Jeff

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2007-11-23 17:41:58 Re: Performance problem with UNION ALL view and domains
Previous Message Dean Rasheed 2007-11-23 13:29:40 Performance problem with UNION ALL view and domains