I have a question about performance issue.
select id, .... from table join ... where condition1
union all
select id, .... from table join ... where condition2
order by 1
there should not be any duplicates in the select statements. then the records will be sorted.
procedure:
create procedure proc
...
begin
for select id, .... from table join ... where condition1 into ....
do suspend;
for select id, .... from table join ... where condition2 into ....
do suspend;
end
then I use select * from proc order by id to get sorted records
which one has better performance? based on my test union all seems faster. thanks
select id, .... from table join ... where condition1
union all
select id, .... from table join ... where condition2
order by 1
there should not be any duplicates in the select statements. then the records will be sorted.
procedure:
create procedure proc
...
begin
for select id, .... from table join ... where condition1 into ....
do suspend;
for select id, .... from table join ... where condition2 into ....
do suspend;
end
then I use select * from proc order by id to get sorted records
which one has better performance? based on my test union all seems faster. thanks