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: Anyone care to vet / explain this test result?

Re: Anyone care to vet / explain this test result?

From: Bib Endum <gd-newsgroups_at_spamex.com>
Date: Tue, 16 Mar 2004 15:56:57 -0500
Message-ID: <QSJ5c.3028$Eb6.165163@news20.bellglobal.com>

"Ed Stevens" <nospam_at_noway.nohow> a écrit dans le message de news:ogle50pj2bis1me3tpj340et1dra5j07t8_at_4ax.com...
> Platform: Oracle 8.1.7 on Win2k
>

[Snip]
>
> Here, we have a clear preference for the Key_Last table. The first
> set of tests is what I would expect, with no clear pattern; this
> definite pattern in the second test seems rather bizarre. Does anyone
> have an explanation for this?
>

Hum, very strange. Notice how the FIRST loop iteration (with the loop version) gives you results similar to individual runs...

Look at you "i" variable, it's initialized OUTSIDE of the x loop ONCE. You do not re-init it IN the loop for subsequent loops, therefor doubling your times.

Correct would be:

DECLARE
   i PLS_INTEGER;
   x PLS_INTEGER;
   kf_tme char(7);
   kl_tme char(7);
   s EDS_TEST_KEY_FIRST.clm_key%TYPE;
   rn PLS_INTEGER;
BEGIN
   SELECT COUNT(*)
INTO rn

     FROM EDS_TEST_KEY_FIRST;    dbms_output.put_line('Key First Key Last');

   for x in 1 .. 20
   loop

     i := dbms_utility.get_time(); -- GD FIX !!!!!!

     FOR i IN REVERSE 1 .. rn
     LOOP
       SELECT clm_key
       INTO s
       FROM EDS_TEST_KEY_FIRST
       WHERE SUPL_KEY = i;
     END LOOP;

     kf_tme := to_char(dbms_utility.get_time()-i);

     i := dbms_utility.get_time();

     FOR i IN REVERSE 1 .. rn
     LOOP
       SELECT clm_key
       INTO s
       FROM EDS_TEST_KEY_LAST
       WHERE SUPL_KEY = i;
     END LOOP;

     kl_tme := to_char(dbms_utility.get_time()-i);

     dbms_output.put_line(kf_tme || '       ' || kl_tme);
   END LOOP;
END;
/ Received on Tue Mar 16 2004 - 14:56:57 CST

Original text of this message

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