Overview
For example, the shared pool stores parsed SQL, PL/SQL code, system parameters, and data dictionary information. The shared pool is involved in almost every operation that occurs in the database. For example, if a user executes a SQL statement, then Oracle Database accesses the shared pool.
Data Dictionary:
- The Data Dictionary Cache stores metadata about the database schema, such as information about tables, columns, indexes, and constraints. This cache helps speed up queries and operations by providing quick access to this metadata.
- The data dictionary is a collection of database tables and views containing reference information about the database, its structures, and its users.
- Oracle Database accesses the data dictionary frequently during SQL statement parsing. The data dictionary is accessed so often by Oracle Database that the following special memory locations are designated to hold dictionary data:
- Data dictionary cache: This cache holds information about database objects. The cache is also known as the row cache because it holds data as rows instead of buffers.
- Library cache: All server processes share these caches for access to data dictionary information.
- The Library Cache is a key component of the Shared Pool in Oracle databases. It plays a critical role in the efficient execution of SQL statements and PL/SQL code.
- The Library Cache stores executable forms of SQL statements, PL/SQL blocks, functions, procedures, and packages.
- Its primary function is to minimize the overhead associated with parsing, compiling, and executing SQL statements and PL/SQL code by caching their executable representations.
- Reduced Parsing Overhead : By storing parsed and compiled SQL statements, the Library Cache reduces the need for repetitive parsing and compilation, saving CPU resources.
- Faster Execution : Reusing cached execution plans and compiled code leads to faster query execution.
- Shared SQL: Enables multiple sessions to share the same SQL execution plans and compiled PL/SQL code, improving memory efficiency and consistency.
- The database represents each SQL statement that it runs in the shared SQL area and private SQL area.
- The database uses the shared SQL area to process the first occurrence of a SQL statement. This area is accessible to all users and contains the statement parse tree and execution plan. Only one shared SQL area exists for a unique statement. Each session issuing a SQL statement has a private SQL area in its PGA. Each user that submits the same statement has a private SQL area pointing to the same shared SQL area. Thus, many private SQL areas in separate PGAs can be associated with the same shared SQL area.
- The database automatically determines when applications submit similar SQL statements. The database considers both SQL statements issued directly by users and applications and recursive SQL statements issued internally by other statements. The database performs the following steps: 1. Checks the shared pool to see if a shared SQL area exists for a syntactically and semantically identical statement: * If an identical statement exists, then the database uses the shared SQL area for the execution of the subsequent new instances of the statement, thereby reducing memory consumption. * If an identical statement does not exist, then the database allocates a new shared SQL area in the shared pool. A statement with the same syntax but different semantics uses a child cursor. In either case, the private SQL area for the user points to the shared SQL area that contains the statement and execution plan. 2. Allocates a private SQL area on behalf of the session The location of the private SQL area depends on the connection established for the session. If a session is connected through a shared server, then part of the private SQL area is kept in the SGA.
The database performs the following steps:
1. Checks the shared pool to see if a shared SQL area exists for a syntactically and semantically identical statement:
* If an identical statement exists, then the database uses the shared SQL area for the execution of the subsequent new instances of the statement, thereby reducing memory consumption.
* If an identical statement does not exist, then the database allocates a new shared SQL area in the shared pool. A statement with the same syntax but different semantics uses a child cursor.
In either case, the private SQL area for the user points to the shared SQL area that contains the statement and execution plan.
2. Allocates a private SQL area on behalf of the session
The location of the private SQL area depends on the connection established for the session. If a session is connected through a shared server, then part of the private SQL area is kept in the SGA.
1. Checks the shared pool to see if a shared SQL area exists for a syntactically and semantically identical statement: