Q

When are records released from SGA?

Once a record is created in PL/SQL, when is that record released from SGA? In other words, must the programmer explicitly release that record from memory or will Oracle release it once the program has finished running?

To answer your question, I'm going to assume that you are asking about PL/SQL record variables...not records inserted into tables.

Here's the general rule of thumb regarding SGA (and PGA) memory usage.

  • When a package is first instantiated, the package p-code is read from disk and put into the shared pool in the SGA. This can be "aged out" if space is needed in the SGA and thus may require reloading.
  • Packaged variables (such as PL/SQL record variables) and cursors are kept in session memory in the PGA. These items will persist for the life of the session.
So, record variables that are populated/used in your application code are maintained in the PGA and thus kept until the user's session ends...not just until the program has finished running. An option a programmer has is to create the package using PRAGMA SERIALLY_REUSABLE.

Packages marked with the PRAGMA SERIALLY_REUSABLE will be kept in the SGA rather than the PGA and will last only for each database call.

For More Information


This was first published in July 2002
This Content Component encountered an error

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close