Tuning for Oracle Read by Other Session Wait Events

7
Tuning for Oracle Read by Other Session Wait Types Confio Software 08/28/2022 1

description

When a session waits on the "read by other session" event, it indicates a wait for another session to read the data from disk into the Oracle buffer cache. If this happens too often the performance of the query or the entire database can suffer. Read by Other Session events in Oracle indicate contention for hot blocks or objects. Learn several methods for solving this issue.

Transcript of Tuning for Oracle Read by Other Session Wait Events

Page 1: Tuning for Oracle Read by Other Session Wait Events

04/13/2023 1

Tuning for Oracle Read by Other Session Wait Types

Confio Software

Page 2: Tuning for Oracle Read by Other Session Wait Events

04/13/2023 2

About the SQL Server PAGEIOLATCH_EX Wait Type

• Buffer latches including the PAGEIOLATCH_EX wait type are used to synchronize access to BUF structures and associated pages in the SQL Server database

• Most frequently occurring buffer latching situation is when serialization is required on a buffer page

Page 3: Tuning for Oracle Read by Other Session Wait Events

04/13/2023 3

Find the contention causing the Read by Other Session Wait

• Tuning for this wait requires first finding and then eliminating the contention

• Check the v$session_wait system view to get information on the blocks being waited for:

SELECT p1 "file#", p2 "block#", p3 "class#" FROM v$session_waitWHERE event = 'read by other session';

• If the same block (or range of blocks) is experiencing waits, this indicates a "hot" block or object

• Use the following query to get the name and type of the object:SELECT relative_fno, owner, segment_name, segment_type FROM dba_extents WHERE file_id = &file AND &block BETWEEN block_id AND block_id + blocks - 1;

Page 4: Tuning for Oracle Read by Other Session Wait Events

04/13/2023 4

Eliminate the contention causing the Read by Other Session Wait

• Eliminate the contention causing the Read by Other Session wait using one of the following methods

• Tune inefficient queries – Use the v$session_wait view (previous slide)– Take the associated system process identifier (c.spid) and see what

information you can obtain from the operating system (because this is a disk operating system issue)

Page 5: Tuning for Oracle Read by Other Session Wait Events

04/13/2023 5

Eliminate contention causing Read by Other Session Wait (con’t)

• Redistribute data from the hot blocks– Delete and reinsert the hot rows—this will often move them to a new data block and help

decrease contention for the hot block and increase performance. – More information about the data residing within the hot blocks can be retrieved with queries

similar to the following:SELECT data_object_id FROM dba_objects WHERE owner='&owner' AND object_name='&object';

SELECT dbms_rowid.rowid_create(1,<data_object_id>,<relative_fno>,<block>,0) start_rowidFROM dual;--rowid for the first row in the block

SELECT dbms_rowid.rowid_create(1,<data_object_id>,<relative_fno>,<block>,500) end_rowidFROM dual; --rowid for the 500th row in the block

SELECT <column_list>FROM <owner>.<segment_name>WHERE rowid BETWEEN <start_rowid> AND <end_rowid>

Page 6: Tuning for Oracle Read by Other Session Wait Events

04/13/2023 6

Eliminate contention causing Read by Other Session Wait (con’t)

• Adjust PCTFREE and PCTUSED – Adjusting the PCTFREE value downward for an object will reduce the number of rows physically

stored in a block – Adjusting the PCTUSED value for an object keeps that object from getting prematurely put back

on the freelist– Depending on the type of contention, adjusting these values could help distribute data among

more blocks and reduce the hot block problem– Be careful to optimize these parameters so blocks do move in and out of the freelist too

frequently• Reduce the block size

– Reduce the amount of data stored within one block– In Oracle 9i and higher this can be achieved by storing the hot object in a tablespace with a

smaller block size– In databases prior to Oracle 9i the entire database must be rebuilt with a smaller block size

• Optimize indexes – A low cardinality index has a relatively small number of unique values, for example, a column

containing state data with only 50 values. – Similar to inefficient queries, the use of a low cardinality index could cause excessive number of

blocks to be read into the buffer cache and cause premature aging out of "good" blocks

Page 7: Tuning for Oracle Read by Other Session Wait Events

04/13/2023 7

Find Root Cause of Oracle Waits Quickly

• Improve database performance by 65% with Confio Ignite for Oracle RAC– Installs in minutes– Puts no load on monitored servers– Identify bottlenecks and root causes of Oracle RAC

waits like these in minutes

Download Ignite trial for freewww.confio.com/freetrial