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.
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
- Dozens more answers to tough Oracle questions from Karen Morton are available.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.