Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: benchmarking, which statement is faster

Re: benchmarking, which statement is faster

From: Steve Long <slong3_at_mediaone.net>
Date: Wed, 25 Jul 2001 14:07:39 GMT
Message-ID: <LoA77.300$NU.201939@typhoon.jacksonville.mediaone.net>

yes. it depends.

"DS" <danny118_at_hotmail.com> wrote in message news:44ff9953.0107241139.496f2ddf_at_posting.google.com...
> hi all,
>
> has anybody benchmarked or has any idea which of the
> following statements will execute faster?
>
>
> a) INSERT INTO TABLE_X (field1,
> field2,
> field3,
> ...
> ...
> ...
> fieldn)
> SELECT source_field1,
> source_field2,
> source_field3,
> ...
> ...
> ...
> source_fieldn)
> FROM TABLE_Z, TABLE_A
> WHERE xx = yy
> AND zz = aa;
>
> b) CURSOR my_cursor IS
> SELECT source_field1,
> source_field2,
> source_field3,
> ...
> ...
> ...
> source_fieldn)
> FROM TABLE_Z, TABLE_A
> WHERE xx = yy
> AND zz = aa;
>
> my_record my_cursor%rowtype;
>
> OPEN my_cursor;
> LOOP
> FETCH my_cursor INTO my_record;
> EXIT WHEN my_cursor%NOTFOUND;
>
> INSERT INTO TABLE_X (field1,
> field2,
> field3,
> ...
> ...
> ...
> fieldn)
> VALUES ( my_cursor.source_field1,
> my_cursor.source_field2,
> my_cursor.source_field3,
> ...
> ...
> my_cursor.source_fieldn);
>
>
> END LOOP;
>
> CLOSE my_cursor;
>
> Note:
>
> 1) The select statements are the same.
> 2) source_field[1..n] can be a simple field from a table
> or the value returned by the invocation of a database function.
>
> thanks.
Received on Wed Jul 25 2001 - 09:07:39 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US