🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #991

UNION ALL or procedure, which one is faster

#991
From: bbgbbg
Date: Fri, 06 Apr 2007 22:50
25 lines
1649 bytes
I have a question about performance issue between UNION ALL and making it a 
procedure.

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
bbgx2@yahoo.com 
Technical Details
Message-ID: <4616cf14$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,59837e1aadbd295e,start
X-Google-Attributes: gid114a0e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "bbgbbg" <bbgx2@yahoo.com>
From: "bbgbbg" <bbgx2@yahoo.com>
Newsgroups: borland.public.interbase.sql
Subject: UNION ALL or procedure, which one is faster
Date: Fri, 6 Apr 2007 18:50:28 -0400
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 69.243.126.233
Message-ID: <4616cf14$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1175899924 69.243.126.233 (6 Apr 2007 15:52:04 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail