Parallel Degree Analysis (parallel.sql)
What This Script Does
Section titled “What This Script Does”This script analyzes parallel degree settings for tables and indexes within specified schemas, identifying objects configured for parallel processing. It shows which database objects are set up to use Oracle’s parallel execution capabilities, helping with performance optimization, resource planning, and parallel processing strategy assessment. The script is essential for understanding and managing parallel execution configurations across database schemas.
The Script
Section titled “The Script”rem parallel.sqlremSET PAUSE OFF;SET LINES 500;ttitle 'Object level parallel report'remCOL degree FORMAT A17 HEADING 'PARALLEL|DEGREE'col table_name format a26 heading 'TABLE|NAME'col INDEX_name format a26 heading 'INDEX|NAME'col INDEX_TYPE format a10 heading 'INDEX|TYPE'remselect degree, table_name from dba_tableswhere owner like nvl(upper('&owner'), '%') AND DEGREE <> 1 ORDER BY DEGREE DESC;
select degree, INDEX_NAME, INDEX_TYPE, TABLE_OWNER, TABLE_NAME from dba_INDEXESwhere owner like nvl(upper('&owner'), '%') AND DEGREE <> 1 ORDER BY DEGREE DESC;
SET PAUSE ON;Key Features
Section titled “Key Features”- Table Parallel Analysis: Shows tables configured with parallel degree > 1
- Index Parallel Analysis: Displays indexes with parallel processing enabled
- Schema Filtering: Supports filtering by owner or analyzing all schemas
- Degree Ranking: Orders results by parallel degree (highest first)
- Comprehensive Coverage: Includes both tables and indexes in analysis
- Configuration Assessment: Enables review of parallel processing setup
@parallel.sqlInput Parameters:
- owner: Schema owner name or pattern (use % for all schemas)
Required Privileges
Section titled “Required Privileges”SELECT on DBA_TABLESSELECT on DBA_INDEXESSample Output
Section titled “Sample Output” Object level parallel report
PARALLEL TABLEDEGREE NAME----------------- --------------------------DEFAULT SALES_FACT_LARGE8 CUSTOMER_HISTORY4 ORDER_DETAILS_ARCHIVE2 PRODUCT_CATALOG
PARALLEL INDEX INDEX TABLE_OWNER TABLEDEGREE NAME TYPE NAME----------------- -------------------------- ---------- -------------------- --------------------------DEFAULT SALES_FACT_PK NORMAL SALES SALES_FACT_LARGE8 CUST_HIST_DATE_IDX NORMAL SALES CUSTOMER_HISTORY4 ORDER_DTL_PROD_IDX NORMAL SALES ORDER_DETAILS_ARCHIVE2 PROD_CAT_NAME_IDX NORMAL PRODUCT PRODUCT_CATALOGKey Output Columns
Section titled “Key Output Columns”Tables Section
Section titled “Tables Section”- PARALLEL DEGREE: Parallel degree setting for the table
- TABLE NAME: Name of the table
Indexes Section
Section titled “Indexes Section”- PARALLEL DEGREE: Parallel degree setting for the index
- INDEX NAME: Name of the index
- INDEX TYPE: Type of index (NORMAL, BITMAP, etc.)
- TABLE_OWNER: Owner of the table the index belongs to
- TABLE NAME: Name of the table the index is on
Understanding Parallel Degree Settings
Section titled “Understanding Parallel Degree Settings”Parallel Degree Values
Section titled “Parallel Degree Values”Degree Interpretations
Section titled “Degree Interpretations”-- Parallel degree meanings:-- 1: No parallel processing (serial execution)-- 2, 4, 8, etc.: Fixed parallel degree-- DEFAULT: Uses system default parallel degree-- Degree > 1: Enables parallel processingAutomatic vs. Manual Settings
Section titled “Automatic vs. Manual Settings”-- Degree setting types:-- Explicit numbers: Manually configured-- DEFAULT: Automatic degree determination-- System calculated: Based on CPU count and parameters-- Workload dependent: May vary by operation typePerformance Implications
Section titled “Performance Implications”Parallel Processing Benefits
Section titled “Parallel Processing Benefits”-- Parallel execution advantages:-- Faster processing for large operations-- Better resource utilization-- Improved throughput for bulk operations-- Reduced elapsed time for complex queriesResource Considerations
Section titled “Resource Considerations”-- Resource impact factors:-- CPU utilization increase-- Memory consumption (PGA)-- I/O subsystem load-- Potential contention with other processesCommon Use Cases
Section titled “Common Use Cases”-
Performance Optimization Review
- Identify objects using parallel processing
- Assess parallel configuration appropriateness
- Support performance tuning efforts
- Validate parallel processing strategy
-
Resource Planning
- Understand parallel resource requirements
- Plan system capacity for parallel workloads
- Assess concurrent parallel operation impact
- Support infrastructure sizing decisions
-
Configuration Management
- Standardize parallel degree settings
- Document parallel processing configuration
- Plan parallel degree modifications
- Support environment consistency
-
Troubleshooting
- Investigate parallel execution issues
- Identify over-parallelized objects
- Support performance problem resolution
- Validate parallel configuration changes
Advanced Analysis
Section titled “Advanced Analysis”Parallel Configuration Assessment
Section titled “Parallel Configuration Assessment”Optimal Degree Analysis
Section titled “Optimal Degree Analysis”-- Assess degree appropriateness:-- Consider object size and access patterns-- Evaluate system resources (CPU, memory)-- Analyze concurrent workload impact-- Review performance improvement vs. costWorkload Correlation
Section titled “Workload Correlation”-- Correlate with workload patterns:-- OLTP vs. data warehouse workloads-- Batch processing requirements-- Interactive query performance-- Mixed workload considerationsResource Impact Analysis
Section titled “Resource Impact Analysis”System Resource Assessment
Section titled “System Resource Assessment”-- Evaluate resource implications:-- Total parallel degree across all objects-- Peak concurrent parallel operations-- Memory requirements (PGA_AGGREGATE_TARGET)-- CPU core utilization patternsContention Analysis
Section titled “Contention Analysis”-- Identify potential contention:-- Over-subscription of CPU resources-- Memory pressure from parallel operations-- I/O subsystem saturation-- Inter-process coordination overheadOptimization Strategies
Section titled “Optimization Strategies”Parallel Degree Optimization
Section titled “Parallel Degree Optimization”Right-Sizing Parallel Degrees
Section titled “Right-Sizing Parallel Degrees”-- Optimization guidelines:-- Large tables/indexes: Higher degrees (4-8)-- Medium objects: Moderate degrees (2-4)-- Small objects: Serial execution (degree 1)-- Consider system capacity and concurrent loadWorkload-Specific Tuning
Section titled “Workload-Specific Tuning”-- Workload optimization:-- OLTP: Minimal parallel usage-- Data warehouse: Aggressive parallel settings-- ETL processes: High parallel degrees-- Reporting: Moderate parallel usageSystem-Level Configuration
Section titled “System-Level Configuration”Parameter Tuning
Section titled “Parameter Tuning”-- Related parameters to optimize:-- PARALLEL_MAX_SERVERS-- PARALLEL_ADAPTIVE_MULTI_USER-- PGA_AGGREGATE_TARGET-- PARALLEL_DEGREE_POLICYResource Allocation
Section titled “Resource Allocation”-- Resource optimization:-- CPU core allocation-- Memory distribution-- I/O bandwidth allocation-- Process pool sizingFiltering Examples
Section titled “Filtering Examples”Specific Schema Analysis
Section titled “Specific Schema Analysis”-- Analyze specific schema:Enter value for owner: SALESAll Schemas Review
Section titled “All Schemas Review”-- Review all schemas:Enter value for owner: %Pattern-Based Analysis
Section titled “Pattern-Based Analysis”-- Analyze schema patterns:Enter value for owner: %DW%Enter value for owner: PROD_%Integration with Performance Monitoring
Section titled “Integration with Performance Monitoring”Parallel Execution Monitoring
Section titled “Parallel Execution Monitoring”Active Parallel Sessions
Section titled “Active Parallel Sessions”-- Monitor active parallel execution:SELECT degree, count(*) sessionsFROM v$px_sessionGROUP BY degreeORDER BY degree DESC;Parallel Execution Statistics
Section titled “Parallel Execution Statistics”-- Analyze parallel execution performance:SELECT name, valueFROM v$sysstatWHERE name LIKE '%parallel%'ORDER BY name;Resource Utilization Tracking
Section titled “Resource Utilization Tracking”Memory Usage Analysis
Section titled “Memory Usage Analysis”-- Monitor PGA usage for parallel operations:SELECT name, value/1024/1024 mbFROM v$pgastatWHERE name LIKE '%parallel%'ORDER BY name;Best Practices
Section titled “Best Practices”Configuration Guidelines
Section titled “Configuration Guidelines”Degree Setting Strategy
Section titled “Degree Setting Strategy”-- Best practice guidelines:-- Start with conservative degrees-- Test and validate performance improvements-- Consider system capacity and concurrent load-- Monitor resource utilization impactObject-Specific Configuration
Section titled “Object-Specific Configuration”-- Object type considerations:-- Fact tables: Higher degrees appropriate-- Dimension tables: Lower degrees typically-- Large indexes: Parallel beneficial-- Small objects: Avoid parallel overheadMonitoring and Maintenance
Section titled “Monitoring and Maintenance”Regular Assessment
Section titled “Regular Assessment”-- Assessment schedule:-- Monthly parallel configuration review-- Quarterly performance impact analysis-- Semi-annual optimization assessment-- Change impact evaluationPerformance Validation
Section titled “Performance Validation”-- Validation process:-- Measure performance before/after changes-- Monitor resource utilization impact-- Assess concurrent workload effects-- Document optimization resultsTroubleshooting Applications
Section titled “Troubleshooting Applications”Performance Issues
Section titled “Performance Issues”Over-Parallelization Problems
Section titled “Over-Parallelization Problems”-- Signs of over-parallelization:-- Increased resource contention-- Longer elapsed times than serial-- High context switching overhead-- Memory pressure from parallel processesUnder-Utilization Issues
Section titled “Under-Utilization Issues”-- Signs of under-utilization:-- Poor performance on large operations-- Unused CPU and I/O capacity-- Long-running batch processes-- Inefficient resource usageConfiguration Problems
Section titled “Configuration Problems”Inappropriate Degree Settings
Section titled “Inappropriate Degree Settings”-- Common configuration issues:-- Small objects with high degrees-- Large objects without parallel settings-- Inconsistent degree settings across related objects-- Failure to consider workload patternsResource Conflicts
Section titled “Resource Conflicts”-- Resource conflict indicators:-- Parallel server pool exhaustion-- Memory allocation failures-- CPU saturation during parallel operations-- I/O bottlenecks from parallel processingRelated Scripts
Section titled “Related Scripts”- vprocess.sql - Process analysis including parallel workers
- dtable.sql - Comprehensive table analysis
- dindex.sql - Index analysis
- gvpga.sql - PGA memory analysis
Enhanced Analysis
Section titled “Enhanced Analysis”Comprehensive Parallel Review
Section titled “Comprehensive Parallel Review”Extended Object Analysis
Section titled “Extended Object Analysis”-- Include additional object information:SELECT t.owner, t.table_name, t.degree, ROUND(s.num_rows/1000000,1) as million_rows, ROUND(s.blocks*8/1024,1) as size_mbFROM dba_tables t, dba_tab_statistics sWHERE t.owner = s.owner AND t.table_name = s.table_name AND t.degree != '1' AND t.owner LIKE nvl(upper('&owner'), '%')ORDER BY t.degree DESC, s.num_rows DESC;Parallel Configuration Summary
Section titled “Parallel Configuration Summary”-- Summarize parallel configuration:SELECT degree, COUNT(*) as object_count, SUM(CASE WHEN object_type = 'TABLE' THEN 1 ELSE 0 END) as tables, SUM(CASE WHEN object_type = 'INDEX' THEN 1 ELSE 0 END) as indexesFROM ( SELECT degree, 'TABLE' as object_type FROM dba_tables WHERE degree != '1' UNION ALL SELECT degree, 'INDEX' as object_type FROM dba_indexes WHERE degree != '1')GROUP BY degreeORDER BY degree DESC;Summary
Section titled “Summary”This script is essential for:
- Parallel Configuration Analysis - Understanding current parallel processing configuration across database objects
- Performance Optimization - Supporting parallel execution strategy development and optimization
- Resource Planning - Planning system resources for parallel workloads and capacity requirements
- Configuration Management - Managing and standardizing parallel degree settings across environments
- Troubleshooting - Diagnosing parallel execution issues and performance problems