Dmitry Karasik <dmitry@xxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance