pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dmitry Karasik <dmitry@karasik.eu.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: seqscan on UNION'ed views
Date: Wed, 27 Feb 2013 09:21:18 -0500
Message-ID: <17937.1361974878@sss.pgh.pa.us> (raw)
In-Reply-To: <20130227100352.GA46292@nataraj.karasik.eu.org>
References: <20130227100352.GA46292@nataraj.karasik.eu.org>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

Dmitry Karasik <dmitry@karasik.eu.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


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (2+ messages)

Message-ID: <17937.1361974878@sss.pgh.pa.us>
Permalink:  ../17937.1361974878@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17937.1361974878@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dmitry@karasik.eu.org
  Subject: Re: seqscan on UNION'ed views
  In-Reply-To: <17937.1361974878@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox