Wednesday, August 20, 2008

V$SQL_WORKAREA_HISTOGRAM

Oracle 11gR1

V$SQL_WORKAREA_HISTOGRAM displays the cumulative work area execution statistics (cumulated since instance startup) for different work area groups. The work areas are split into 33 groups based on their optimal memory requirements with the requirements increasing in powers of two. That is, work areas whose optimal requirement varies from 0 KB to 1 KB, 1 KB to 2 KB, 2 KB to 4 KB, ... and 2 TB to 4 TB.

For each work area group, the V$SQL_WORKAREA_HISTOGRAM view shows how many work areas in that group were able to run in optimal mode, how many were able to run in one-pass mode, and finally how many ran in multi-pass mode. The DBA can take a snapshot at the beginning and the end of a desired time interval to derive the same statistics for that interval.

Column

Datatype

Description

LOW_OPTIMAL_SIZE

NUMBER

Lower bound for the optimal memory requirement of work areas included in this row (bytes)

HIGH_OPTIMAL_SIZE

NUMBER

Upper bound for the optimal memory requirement of work areas included in this row (bytes)

OPTIMAL_EXECUTIONS

NUMBER

Number of work areas with an optimal memory requirement comprised between LOW_OPTIMAL_SIZE and HIGH_OPTIMAL_SIZE which have been executed in optimal mode since instance startup

ONEPASS_EXECUTIONS

NUMBER

Number of work areas with an optimal memory requirement comprised between LOW_OPTIMAL_SIZE and HIGH_OPTIMAL_SIZE which have been executed in one-pass mode since instance startup

MULTIPASSES_EXECUTIONS

NUMBER

Number of work areas with an optimal memory requirement comprised between LOW_OPTIMAL_SIZE and HIGH_OPTIMAL_SIZE which have been executed in multi-pass mode since instance startup

TOTAL_EXECUTIONS

NUMBER

Sum of OPTIMAL_EXECUTIONS, ONEPASS_EXECUTIONS, and MULTIPASSES_EXECUTIONS

Note:

1. SELECT * FROM V$SQL_WORKAREA_HISTOGRAM;

LOW_OPTIMAL

_SIZE

HIGH_OPTIMAL

_SIZE

OPTIMAL

_EXECUTIONS

ONEPASS

_EXECUTIONS

MULTIPASSES

_EXECUTIONS

TOTAL

_EXECUTIONS

0

1023

0

0

0

0

1024

2047

0

0

0

0

2048

4095

697681

0

0

697681

4096

8191

0

0

0

0

8192

16383

0

0

0

0

Oracle dynamic performance views

V$PGASTAT

Thank you for visiting Spatial DBA - Oracle and ArcSDE.

I have stopped updating the blog.

Please visit Oracle DBA Tips (http://www.oracledbatips.com) for more Oracle DBA Tips.
==================================================================
 



Oracle 11gR1
V$PGASTAT displays PGA memory usage statistics as well as statistics about the automatic PGA memory manager when it is enabled (that is, when PGA_AGGREGATE_TARGET is set). Cumulative values in V$PGASTAT are accumulated since instance startup.

Column
Datatype
Description
NAME
VARCHAR2(64)
Name of the statistic (see table below)
VALUE
NUMBER
Statistic value
UNIT
VARCHAR2(12)
Unit for the value:
· bytes
· microseconds
· percent
V$PGASTAT Statistics
Statistic Name
Description
aggregate PGA target parameter Current value of the PGA_AGGREGATE_TARGET initialization parameter. If this parameter is not set, then its value is 0 and automatic management of PGA memory is disabled.
aggregate PGA auto target Amount of PGA memory the Oracle Database can use for work areas running in automatic mode. This amount is dynamically derived from the value of the PGA_AGGREGATE_TARGET initialization parameter and the current work area workload, and continuously adjusted by the Oracle Database.
If this value is small compared to the value of PGA_AGGREGATE_TARGET, then a large amount of PGA memory is used by other components of the system (for example, PL/SQL or Java memory) and little is left for work areas. The DBA must ensure that enough PGA memory is left for work areas running in automatic mode.
global memory bound Maximum size of a work area executed in automatic mode. This value is continuously adjusted by the Oracle Database to reflect the current state of the work area workload. The global memory bound generally decreases when the number of active work areas is increasing in the system.
If the value of the global bound decreases below 1 MB, then the value of PGA_AGGREGATE_TARGET should be increased.
total PGA allocated Current amount of PGA memory allocated by the instance. The Oracle Database attempts to keep this number below the value of the PGA_AGGREGATE_TARGET initialization parameter. However, it is possible for the PGA allocated to exceed that value by a small percentage and for a short period of time when the work area workload is increasing very rapidly or when PGA_AGGREGATE_TARGET is set to a small value.
total PGA used Indicates how much PGA memory is currently consumed by work areas. This number can be used to determine how much memory is consumed by other consumers of the PGA memory (for example, PL/SQL or Java).
total PGA used for auto workareas Indicates how much PGA memory is currently consumed by work areas running under the automatic memory management mode. This number can be used to determine how much memory is consumed by other consumers of the PGA memory (for example, PL/SQL or Java).
total PGA used for manual workareas Indicates how much PGA memory is currently consumed by work areas running under the manual memory management mode. This number can be used to determine how much memory is consumed by other consumers of the PGA memory (for example, PL/SQL or Java).
over allocation count This statistic is cumulative since instance startup. Over allocating PGA memory can happen if the value of PGA_AGGREGATE_TARGET is too small. When this happens, the Oracle Database cannot honor the value of PGA_AGGREGATE_TARGET and extra PGA memory needs to be allocated.
If over allocation occurs, then increase the value of PGA_AGGREGATE_TARGET using the information provided by the V$PGA_TARGET_ADVICE view.
bytes processed Number of bytes processed by memory intensive SQL operators, cumulated since instance startup.
extra bytes read/written Number of bytes processed during extra passes of the input data, cumulated since instance startup. When a work area cannot run optimal, one or more of these extra passes is performed.
cache hit percentage A metric computed by the Oracle Database to reflect the performance of the PGA memory component, cumulative since instance startup. A value of 100% means that all work areas executed by the system since instance startup have used an optimal amount of PGA memory.
When a work area cannot run optimal, one or more extra passes is performed over the input data. This will reduce the cache hit percentage in proportion to the size of the input data and the number of extra passes performed.
Note:
1. SELECT * FROM V$PGASTAT;
NAME
VALUE
UNIT
aggregate PGA target parameter
104857600
bytes
aggregate PGA auto target
67977216
bytes
global memory bound
20971520
bytes
total PGA inuse
29320192
bytes
total PGA allocated
55439360
bytes
maximum PGA allocated
128949248
bytes
total freeable PGA memory
8650752
bytes
process count
21
NULL
max processes count
27
NULL
PGA memory freed back to OS
6334709760
bytes
total PGA used for auto workareas
0
bytes
maximum PGA used for auto workareas
21029888
bytes
total PGA used for manual workareas
0
bytes
maximum PGA used for manual workareas
537600
bytes
over allocation count
0
NULL
bytes processed
19439247360
bytes
extra bytes read/written
3792268288
bytes
cache hit percentage
83.67
percent
recompute count (total)
998308
NULL

Oracle dynamic performance views

V$SQL_WORKAREA_ACTIVE

Oracle 11gR1

V$SQL_WORKAREA_ACTIVE contains an instantaneous view of the work areas currently allocated by the system. You can join this view against V$SQL_WORKAREA on WORKAREA_ADDRESS to access the definition of that work area. If a work area spills to disk, then this view contains information for the temporary segment created on behalf of this work area.

The last three columns are included to enable joining V$SQL_WORKAREA_ACTIVE with V$TEMPSEG_USAGE to retrieve more information on this temporary segment.

You can use this view to answer the following:

· What are the top 10 largest work areas currently allocated in the system?

· What percentage of memory is over-allocated (EXPECTED_SIZE < ACTUAL_MEM_USED) and under-allocated (EXPECTED_SIZE > ACTUAL_MEM_USED)?

· What are the active work areas using more memory than what is expected by the memory manager?

· What are the active work areas that have spilled to disk?

Column

Datatype

Description

SQL_HASH_VALUE

NUMBER

Hash value of the SQL statement that is currently being executed

SQL_ID

VARCHAR2(13)

SQL identifier of the SQL statement that is currently being executed

SQL_EXEC_START

DATE

Time when the execution of the SQL currently executed by this session started

SQL_EXEC_ID

NUMBER

SQL execution identifier (see V$SQL_MONITOR)

WORKAREA_ADDRESS

RAW(4 | 8)

Address of the work area handle. This is the primary key for the view.

OPERATION_TYPE

VARCHAR2(20)

Type of operation using the work area (SORT, HASH JOIN, GROUP BY, BUFFERING, BITMAP MERGE, or BITMAP CREATE)

OPERATION_ID

NUMBER

A unique number used to identify the operation in the execution plan. This identifier can be joined to V$SQL_PLAN to locate the operation that uses this work area.

POLICY

VARCHAR2(6)

Sizing policy for this work area (MANUAL or AUTO)

SID

NUMBER

Session identifier

QCINST_ID

NUMBER

Query coordinator instance identifier. Along with QCSID, enables you to uniquely identify the query coordinator.

QCSID

NUMBER

Query coordinator session identifier. This is the same as the SID if the work area is allocated by a serial cursor.

ACTIVE_TIME

NUMBER

Average time this work area is active (in hundredths of a second)

WORK_AREA_SIZE

NUMBER

Maximum size (in bytes) of the work area as it is currently used by the operation

EXPECTED_SIZE

NUMBER

Expected size (in bytes) for this work area. EXPECTED_SIZE is set on behalf of the operation by the memory manager. Memory can be over-allocated when WORK_AREA_SIZE has a higher value than EXPECTED_SIZE. This can occur when the operation using this work area takes a long time to resize it.

ACTUAL_MEM_USED

NUMBER

Amount of PGA memory (in bytes) currently allocated on behalf of this work area. This value should range between 0 and WORK_AREA_SIZE.

MAX_MEM_USED

NUMBER

Maximum memory amount (in bytes) used by this work area

NUMBER_PASSES

NUMBER

Number of passes corresponding to this work area (0 if running in OPTIMAL mode)

TEMPSEG_SIZE

NUMBER

Size (in bytes) of the temporary segment used on behalf of this work area. This column is NULL if this work area has not (yet) spilled to disk.

TABLESPACE

VARCHAR2(30)

Tablespace name for the temporary segment created on behalf of this work area. This column is NULL if this work area has not (yet) spilled to disk.

SEGRFNO#

NUMBER

Relative file number within the tablespace for the temporary segment created on behalf of this work area. This column is NULL if this work area has not (yet) spilled to disk.

SEGBLK#

NUMBER

Block number for the temporary segment created on behalf of this work area. This column is NULL if this work area has not (yet) spilled to disk.

Note:

1. SELECT sql_hash_value, sql_id, operation_type, policy, sid, work_area_size, actual_mem_used, tempseg_size, tablespace

FROM V$SQL_WORKAREA_ACTIVE;

SQL_HASH

_VALUE

SQL_ID

OPERATION_TYPE

POLICY

SID

WORK_AREA

_SIZE

ACTUAL_MEM

_USED

TEMPSEG_

SIZE

TABLESPACE

1679125978

g22rnbdk1avfu

HASH-JOIN

AUTO

2196

17917952

10025984

1217396736

TEMP

175263300

g56j680574mk4

HASH-JOIN

AUTO

2129

3726336

3577856

NULL

NULL

576637872

gx7gk1nj5xkxh

LOAD WRITE BUFFERS

AUTO

2326

0

0

NULL

NULL

1721781002

3qr082tma0ksa

GROUP BY (SORT)

AUTO

2289

278528

278528

NULL

NULL

3993155112

f7j93nrr05dj8

SORT (v2)

AUTO

2231

821248

821248

NULL

NULL

2154551539

6cuagwa06rq7m

GROUP BY (SORT)

AUTO

2229

311296

311296

NULL

NULL

3139891090

f56vtt2xkdvwk

HASH-JOIN

AUTO

1793

12495872

15559680

NULL

NULL

Oracle dynamic performance views

V$SQL_WORKAREA

Oracle 11gR1

V$SQL_WORKAREA displays information about work areas used by SQL cursors. Each SQL statement stored in the shared pool has one or more child cursors that are listed in the V$SQL view. V$SQL_WORKAREA lists all work areas needed by these child cursors; V$SQL_WORKAREA can be joined with V$SQLAREA on (ADDRESS, HASH_VALUE) and with V$SQL on (ADDRESS, HASH_VALUE, CHILD_NUMBER).

You can use this view to find out answers to the following questions:

· What are the top 10 work areas that require the most cache area?

· For work areas allocated in AUTO mode, what percentage of work areas are running using maximum memory?

Column

Datatype

Description

ADDRESS

RAW(4 | 8)

Address of the parent cursor handle

HASH_VALUE

NUMBER

Hash value of the parent statement in the library cache. Two columns PARENT_HANDLE and HASH_VALUE can be used to join with V$SQLAREA to locate the parent cursor.

SQL_ID

VARCHAR2(13)

SQL identifier of the parent statement in the library cache

CHILD_NUMBER

NUMBER

Number of the child cursor that uses this work area. The columns PARENT_HANDLE, HASH_VALUE, and CHILD_NUMBER can be used to join with V$SQL to locate the child cursor using this area.

WORKAREA_ADDRESS

RAW(4 | 8)

Address of the work area handle. This is the primary key for the view.

OPERATION_TYPE

VARCHAR2(20)

Type of operation using the work area (SORT, HASH JOIN, GROUP BY, BUFFERING, BITMAP MERGE, or BITMAP CREATE)

OPERATION_ID

NUMBER

A unique number used to identify the operation in the execution plan. This identifier can be joined to V$SQL_PLAN to locate the operation that uses this work area.

POLICY

VARCHAR2(10)

Sizing policy for this work area (MANUAL or AUTO)

ESTIMATED_OPTIMAL_SIZE

NUMBER

Estimated size (in bytes) required by this work area to execute the operation completely in memory (optimal execution). Derived from either optimizer statistics or previous executions.

ESTIMATED_ONEPASS_SIZE

NUMBER

Estimated size (in bytes) required by this work area to execute the operation in a single pass. Derived from either optimizer statistics or previous executions.

LAST_MEMORY_USED

NUMBER

Memory (in bytes) used by this work area during the last execution of the cursor

LAST_EXECUTION

VARCHAR2(10)

Indicates whether this work area runs using OPTIMAL, ONE PASS, or ONE PASS memory requirement (or MULTI-PASS), during the last execution of the cursor

LAST_DEGREE

NUMBER

Degree of parallelism used during the last execution of this operation

TOTAL_EXECUTIONS

NUMBER

Number of times this work area was active

OPTIMAL_EXECUTIONS

NUMBER

Number of times this work area ran in optimal mode

ONEPASS_EXECUTIONS

NUMBER

Number of times this work area ran in one-pass mode

MULTIPASSES_EXECUTIONS

NUMBER

Number of times this work area ran below the one-pass memory requirement

ACTIVE_TIME

NUMBER

Average time this work area is active (in hundredths of a second)

MAX_TEMPSEG_SIZE

NUMBER

Maximum temporary segment size (in bytes) created by an instantiation of this work area. This column is NULL if this work area has never spilled to disk.

LAST_TEMPSEG_SIZE

NUMBER

Temporary segment size (in bytes) created in the last instantiation of this work area. This column is NULL if the last instantiation of this work area did not spill to disk.

Note:

1.

SELECT hash_value, sql_id, operation_type, policy, estimated_optimal_size, total_executions

FROM V$SQL_WORKAREA;

HASH_VALUE

SQL_ID

OPERATION_TYPE

POLICY

ESTIMATED_OPTIMAL_SIZE

TOTAL_EXECUTIONS

561512464

8c4yc5whrh00h

GROUP BY (SORT)

AUTO

36864

308

3581149450

9f61byrar808a

SORT (v2)

AUTO

2048

392

3971875106

6s6qhf7qbw092

HASH-JOIN

AUTO

831488

3

2351695638

0dw4ur262s1sq

BUFFER

AUTO

55296

7

275908960

6x2hwbs8742b0

IDX MAINTENANCE (SOR

AUTO

1024

2

3547466279

9636a7g9r42j7

CONNECT-BY (SORT)

AUTO

73728

0

Oracle dynamic performance views