Shared Pool
The shared pool is a crucial component of the Oracle database that caches various types of program data, enhancing performance and efficiency.
Purpose: The shared pool stores parsed SQL statements, PL/SQL code, system parameters, and data dictionary information. It plays a role in nearly every database operation, such as executing SQL statements.
Components of the Shared Pool
Library Cache:
- The library cache stores executable SQL and PL/SQL code.
- It includes shared SQL areas and control structures like locks and handles. In a shared server architecture, it also contains private SQL areas.
- When a SQL statement is executed, the database checks the library cache to reuse previously executed code. If a match is found, it’s called a soft parse (library cache hit); otherwise, a new executable version is created (hard parse or library cache miss).
Shared SQL Areas:
- Each SQL statement executed is represented in a shared SQL area, accessible to all users. This area contains the statement’s parse tree and execution plan.
- Each session that runs the same statement has a private SQL area in its Program Global Area (PGA), pointing to the same shared SQL area, allowing for efficient memory use
Data Dictionary Cache:
- The data dictionary is a collection of tables and views that provide reference information about the database structure and its users.
- The data dictionary cache holds metadata about database objects, and is frequently accessed during SQL statement parsing.
Server Result Cache:
- This memory pool within the shared pool holds result sets rather than data blocks, allowing for faster access to query results.
Reserved Pool:
- The reserved pool allocates large contiguous chunks of memory from the shared pool, reducing the likelihood of fragmentation.
- It is especially useful for allocations larger than 5 KB, enabling efficient memory management for Java, PL/SQL, or SQL cursors