pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PFC <lists@peufeu.com>
To: Zoltan Boszormenyi <zboszor@dunaweb.hu>
To: pgsql-performance@postgresql.org
Subject: Re: Auto-tuning a VIEW?
Date: Wed, 14 Dec 2005 22:38:49 +0100
Message-ID: <op.s1smezd8cigqcu@peufeu.com> (raw)
In-Reply-To: <43A08EF5.4060306@dunaweb.hu>
References: <43A08EF5.4060306@dunaweb.hu>


> 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' ?



view thread (4+ messages)  latest in thread

Message-ID: <op.s1smezd8cigqcu@peufeu.com>
Permalink:  ../op.s1smezd8cigqcu@peufeu.com/
Also on:    postgresql.org/message-id/op.s1smezd8cigqcu@peufeu.com

 · 

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: lists@peufeu.com, zboszor@dunaweb.hu
  Subject: Re: Auto-tuning a VIEW?
  In-Reply-To: <op.s1smezd8cigqcu@peufeu.com>

* 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