Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle PL/SQL: Any benefits in changing PLSQL_CODE_TYPE from interpreted to native?

Are there are tangible benefits in changing the PLSQL_CODE_TYPE from interpreted to native? Was wondering if there are any case studies on the same.

If benefit justifies the change, how can I go about implementing the same ?

My platform is Windows 2003 server, running Oracle 10gR2 (10.2.0.1.0) if that helps.

like image 982
Sathyajith Bhat Avatar asked Jul 27 '09 00:07

Sathyajith Bhat


People also ask

Is PL SQL interpreted or compiled?

PL/SQL executes in a virtual machine, and it first translates (compiles) your code into virtual machine code, sometimes called bytecode or mcode. This is basically the same model that Java uses. When it is time to actually run your code, however, that bytecode is translated (interpreted) into system calls.

What is meant by native compilation in Oracle?

Native compilation is the process by which a stored PL/SQL program is compiled into native code that does not need to be interpreted at runtime. In comparison, code that is not natively compiled is stored in an intermediate form that must be interpreted at runtime.

What are the different ways in which PL SQL can run native execution?

Using an Oracle tool, such as SQL*Plus. Calling it explicitly in the code of a database application, such as an Oracle Forms or precompiler application. Calling it explicitly in the code of another procedure or trigger.


3 Answers

The benefit should be speed. Whether it is 'tangible' depends on whether PL/SQL performance is an issue for you. It won't give any benefit on the SQL side (eg SELECTing) or if you have latency issues elsewhere (eg calling web services).

Unless you are doing some computationally heavy tasks in PL/SQL, I suspect you won't notice a difference. I'd be much more concerned about running the database without the appropriate patches, so would recommend you look to applying the patchsets to get you to 10.2.0.4

like image 109
Gary Myers Avatar answered Oct 18 '22 23:10

Gary Myers


Just to supplement Gary's excellent answer (which I voted up) here is some further information from the Oracle documentation

http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/tuning.htm#LNPLS01209

like image 5
Ian Carpenter Avatar answered Oct 18 '22 22:10

Ian Carpenter


In addition to the excellent answers already given, unless you really need to switch to Native now, I would recommend waiting until you migrate to Oracle 11g. Here is a relevant paragraph from the documentation:

Starting with Oracle Database 11g, PL/SQL Native Compilation does not need a C compiler. Therefore, if you presently use a C compiler only to support PL/SQL Native Compilation, you can remove it from the machine where your database is installed (and from each node in an Oracle RAC configuration).

We have switched to Native compilation in our 11g database, but we don't do a lot of computationally intensive PL/SQL, so our performance gains have been almost insignificant. We hope to have code in the future that will take greater advantage of it. On the plus side it hasn't caused us any problems and was easy to do.

like image 3
Leigh Riffel Avatar answered Oct 18 '22 23:10

Leigh Riffel