Re: union all taking years - PG 9.6

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Patrick B <patrickbakerbr(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: union all taking years - PG 9.6
Date: 2017-05-15 23:31:33
Message-ID: 70e274c6-7b10-782a-8bdb-9eabcb354dc4@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 05/15/2017 04:21 PM, Patrick B wrote:
> Hi guys.
>
> I have two tables, where 'tableA' is the old and 'tableC' is the new
> one. I say "new/old" because we are migrating the data from tableA to
> tableC soon.
>
> I created a view selecting from both tables, with a UNION ALL between
> them. When selecting from that view, it's really slow. I can't even run
> explain analyze (it's been 1h and query did not finished yet).
>
> However, when running both selects with explain analyze, query is fast.
>
>
> What should I do in this case? Why is that taking so long? I assume it's
> because the UNION will look for duplicates?

Without actual information, the only thing that can be said is that it
is slow.

Information needed:

Postgres version

Table schema for tableA and tableC

The view query

The output of the explain for the view query.

>
> Thanks
> Patrick.

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2017-05-15 23:34:35 Re: Add NAMEDATALEN to PG_CONFIG?
Previous Message Andy Johnson 2017-05-15 23:27:30 Add NAMEDATALEN to PG_CONFIG?