Re: Auto-tuning a VIEW?

From: PFC <lists(at)peufeu(dot)com>
To: "Zoltan Boszormenyi" <zboszor(at)dunaweb(dot)hu>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Auto-tuning a VIEW?
Date: 2005-12-14 21:38:49
Message-ID: op.s1smezd8cigqcu@peufeu.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


> create view v1 (code,num) as
> select 'AAA',id from table1
> union
> select 'BBB',id from table2;

As your rows are, by definition, distinct between each subquery, you
should use UNION ALL instead of UNION to save postgres the trouble of
hunting non-existing duplicates. This will save you a few sorts.

> select * from v1 where code||num = 'AAA2005000001';

Why don't you use code='AAA' and num='2005000001' ?

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Kevin Brown 2005-12-14 22:03:52 Simple Join
Previous Message Zoltan Boszormenyi 2005-12-14 21:30:29 Auto-tuning a VIEW?