Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Performance SIMPLE_INTEGER VS PLS_INTEGER in NATIVE

user8400219May 31 2017 — edited Jun 2 2017

Hi All,

Was going through whether PLS_INTEGER or SIMPLE_INTEGER is performance effective. For that used the code snippet given below and tested the same through SQLPLUS in NATIVE and INTERPRETED code type but as stated at one of the URL:

https://docs.oracle.com/cd/B28359_01/appdev.111/b28370/datatypes.htm#CIHGBFGB

SIMPLE_INTEGER provides significantly better performance than PLS_INTEGER when PLSQL_CODE_TYPE='NATIVE', because arithmetic operations on SIMPLE_INTEGER values are done directly in the hardware. When PLSQL_CODE_TYPE='INTERPRETED', the performance improvement is smaller.

There is not any dramatic improvement in operations of SIMPLE_INTEGER variable performance when PLSQL_CODE_TYPE changed to NATIVE from INTERPRETED.

create or replace PROCEDURE simple_integer_test_proc AS

l_start NUMBER;

l_loops NUMBER := 1000000000;

l_pls_integer PLS_INTEGER := 0;

l_pls_integer_incr PLS_INTEGER := 1;

l_simple_integer SIMPLE_INTEGER := 0;

l_simple_integer_incr SIMPLE_INTEGER := 1;

BEGIN

l_start := DBMS_UTILITY.get_time;

FOR i IN 1 .. l_loops LOOP

l\_pls\_integer := l\_pls\_integer + l\_pls\_integer\_incr;

END LOOP;

DBMS_OUTPUT.put_line('PLS_INTEGER: ' || (DBMS_UTILITY.get_time - l_start) || ' hsecs');

l_start := DBMS_UTILITY.get_time;

FOR i IN 1 .. l_loops LOOP

l\_simple\_integer := l\_simple\_integer + l\_simple\_integer\_incr;

END LOOP;

DBMS_OUTPUT.put_line('SIMPLE_INTEGER: ' || (DBMS_UTILITY.get_time - l_start) || ' hsecs');

END simple_integer_test_proc;

pastedImage_0.png

This post has been answered by unknown-7404 on May 31 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 30 2017
Added on May 31 2017
25 comments
2,135 views