Re: Select Union - Mailing list pgsql-general

From Tom Lane
Subject Re: Select Union
Date
Msg-id 16822.1080878999@sss.pgh.pa.us
Whole thread Raw
In response to Re: Select Union  (Randall Skelton <skelton@brutus.uwaterloo.ca>)
List pgsql-general
Randall Skelton <skelton@brutus.uwaterloo.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

pgsql-general by date:

Previous
From: joseph speigle
Date:
Subject: Re: Problems compiling Apache 2.0.49 with mod_auth_pgsql
Next
From: "BARTKO, Zoltan"
Date:
Subject: Loading text files into a text attribute