X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 35483474E44 for ; Sat, 1 Mar 2003 07:31:13 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 02944-05 for ; Sat, 1 Mar 2003 07:31:12 -0500 (EST) Received: from snickers.hotpop.com (snickers.hotpop.com [204.57.55.49]) by postgresql.org (Postfix) with ESMTP id 0C1B1474E42 for ; Sat, 1 Mar 2003 07:31:12 -0500 (EST) Received: from hotpop.com (kubrick.hotpop.com [204.57.55.16]) by snickers.hotpop.com (Postfix) with SMTP id 8B1D172EA9 for ; Sat, 1 Mar 2003 12:30:22 +0000 (UTC) Received: from societykotla (unknown [61.0.95.123]) by smtp-2.hotpop.com (Postfix) with ESMTP id 72DA71800C8 for ; Sat, 1 Mar 2003 12:30:19 +0000 (UTC) Message-ID: <004801c2dfee$dc4dc550$c9c832c0@societykotla> From: "Aspire Something" To: Subject: Arrays in Postgresql Processes Date: Sat, 1 Mar 2003 18:03:51 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0045_01C2E01C.EA700070" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-HotPOP: ----------------------------------------------- Sent By HotPOP.com FREE Email Get your FREE POP email at www.HotPOP.com ----------------------------------------------- X-Virus-Scanned: by amavisd-new X-Archive-Number: 200303/4 X-Sequence-Number: 12044 This is a multi-part message in MIME format. ------=_NextPart_000_0045_01C2E01C.EA700070 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi all , In our project we have to run a plpgsql function its. algorithm is something like this 1. Determine the id (we will call it roll_number) valid for the process from the huge table, Roll number is a Seqence index with value starting from 1 ....... BIGINT 2. When the roll_number is valid selects its data from some other huge table =2E 3 Now run a plpgsql function on the Roll number. To do this I am using a code like this create function blah blah Returns XXX as ' all var declared; roll_data school_data%ROWTYPE; BEGIN select max(maxl_roll) from school_data ; FOR i IN 1..max_roll LOOP select * from school_data where roll_number =3D i ; if roll_data.class =3D 10 THEN do some work END IF; END LOOP; END; some more blahblah plpgsql ' Now my question is =3D> 1. Is this approch execute code fast when u are selecting roll_number 1 thru 10Thusand + . 2. Can we use array for the above thing as a. Make an array of the valid roll_numbers. such as ('IDX'=3D>'ROLL_NUMBER'........) b. Now select the array element by the index which will produce the roll_number and work on it. c. Array could be build by for loop 3. Will the array approch execute code fast. if yes can you please give me some refrences so that i can actually build one such function. 4. Lastly if i use views will they help in fas execution Please pour in your valuable knowledge Regards, V Kashyap. ------=_NextPart_000_0045_01C2E01C.EA700070 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi= all=20 ,

In our project we have to run a plpgsql function
its. algorithm= is=20 something like this
1. Determine the id (we will call it roll_number) va= lid=20 for the process from
the huge=20 table,
           = ;=20 Roll number is a Seqence index with value starting from 1
.......=20 BIGINT
2. When the roll_number is valid selects its data from some other= huge=20 table
.
3 Now run a plpgsql function on the Roll number.

To do= this=20 I am using a code like this
<code>
create function blah blah Re= turns=20 XXX as '
all var declared;
roll_data=20 school_data%ROWTYPE;
BEGIN
select max(maxl_roll) from school_data ;FOR=20 i IN 1..max_roll LOOP
select *  from school_data where roll_number = =3D i=20 ;
if roll_data.class =3D 10 THEN
do some work
END IF;
END=20 LOOP;
END;
some more blahblah plpgsql '
</code>
Now my=20 question is =3D>
1. Is this approch execute code fast when u are sele= cting=20 roll_number 1 thru
10Thusand + .
2. Can we use array for the above th= ing=20 as
    a. Make an array of the valid roll_numbers. such= =20 as
('IDX'=3D>'ROLL_NUMBER'........)
    b. Now sele= ct the=20 array element by the index which will produce the
roll_number and work o= n=20 it.
    c. Array could be build by for loop
3. Will th= e=20 array approch execute code fast. if yes can you please give me
some refr= ences=20 so that i can=20 actually
          &nb= sp;=20 build one such function.
4. Lastly if i use views will they help in fas= =20 execution

Please pour in your valuable knowledge

Regards,
= V=20 Kashyap.


------=_NextPart_000_0045_01C2E01C.EA700070--