Re: seqscan on UNION'ed views

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dmitry Karasik <dmitry(at)karasik(dot)eu(dot)org>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: seqscan on UNION'ed views
Date: 2013-02-27 14:21:18
Message-ID: 17937.1361974878@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Dmitry Karasik <dmitry(at)karasik(dot)eu(dot)org> writes:
> I need to have a sort of a time machine, where select statements on tables
> could be easily replaced to select statements on tables as they were some time in the past,
> including all related table. To do so, I used views (see in the script) that UNION
> both current and archive tables and filter them by a timestamp.

If you use UNION ALL instead of UNION, you should get better results
(as well as inherently cheaper queries, since no duplicate-elimination
step will be needed).

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Matt Daw 2013-02-27 17:08:45 Re: Estimation question...
Previous Message Andre 2013-02-27 10:52:44 Re: Server stalls, all CPU 100% system time