Re: Select Union

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Randall Skelton <skelton(at)brutus(dot)uwaterloo(dot)ca>
Cc: Nick Barr <nicky(at)chuckie(dot)co(dot)uk>, pgsql-general(at)postgresql(dot)org
Subject: Re: Select Union
Date: 2004-04-02 04:09:59
Message-ID: 16822.1080878999@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Randall Skelton <skelton(at)brutus(dot)uwaterloo(dot)ca> writes:
> As you suggested, while this is much shorter in length, it is
> considerably longer in execution.

>> SELECT t1.timestamp FROM (
>> SELECT timestamp FROM cal_quat_1 UNION
>> SELECT timestamp FROM cal_quat_2 UNION
>> SELECT timestamp FROM cal_quat_3 UNION
>> SELECT timestamp FROM cal_quat_4 UNION
>> SELECT timestamp FROM cal_ccd_temp
>> ) t1 WHERE
>> t1.timestamp BETWEEN '2004-02-01 00:03:30' AND '2004-02-01
>> 00:04:00';

Do you actually need UNION, or would UNION ALL do? (The latter doesn't
try to eliminate duplicates.)

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vinay Jain 2004-04-02 04:47:50 Create Type Problem
Previous Message joseph speigle 2004-04-02 03:54:52 Re: Problems compiling Apache 2.0.49 with mod_auth_pgsql