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