🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Speed with Procedure

#266
From: Adalberto Baldini
Date: Thu, 07 Feb 2008 13:46
39 lines
1977 bytes
Only to understand query speed with Procedure, If I

CREATE PROCEDURE Proc_1
returns (   cod1 varchar(10),  cod2 smallint, cod3 smallint)
as
begin
  for
   Select cod1, cod2, cod3 from Tab1
   where cod2>cod3
   into:cod1, :cod2, :cod3
   do    suspend  ;
end

and I query it with

Select * from Proc_1
where cod1 = 'test1'

a) Proc1 select only record matching the where clause of the query, or
b) Proc1 retrives before all its records and after query select those 
required  by its where condition ?

Following construct should be faster than previous ?

Select * from Proc_1('test1')

CREATE PROCEDURE Proc_1 ( input1 varchar(10))
returns (  cod1 varchar(10),  cod2 smallint, cod3 smallint)
as
begin
  for
   Select cod1, cod2, cod3 from Tab1
   where (cod1 = :input1) and cod2>cod3
   into:cod1, :cod2, :cod3
   do    suspend  ;
end

Thanks
Adalberto Baldini
Technical Details
Message-ID: <47ab0bac@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!feeder.erje.net!news2.arglkargh.de!news.osn.de!diablo1.news.osn.de!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,ddeb009208f7937f,start
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Thu, 07 Feb 2008 14:46:27 +0100
From: Adalberto Baldini <finman@swissonline.ch>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.interbase.sql
Subject: Speed with Procedure
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 080206-0, 06/02/2008), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: 83.76.131.49
Message-ID: <47ab0bac@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1202391980 83.76.131.49 (7 Feb 2008 05:46:20 -0700)
Lines: 39
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!feeder.erje.net!news2.arglkargh.de!news.osn.de!diablo1.news.osn.de!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail