union all taking years - PG 9.6

From: Patrick B <patrickbakerbr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: union all taking years - PG 9.6
Date: 2017-05-15 23:21:41
Message-ID: CAJNY3ivu8eFkHWFA0k6FAoKyo1-hkEPPwoecy_1dK-sb_fNSFQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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?

Thanks
Patrick.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andy Johnson 2017-05-15 23:27:30 Add NAMEDATALEN to PG_CONFIG?
Previous Message Thomas Kellerer 2017-05-15 20:52:10 Re: Insert performance and disk usage in JSON vs JSONB