Tuesday, February 27, 2024

optimizer parameters in oracle 19c db

begin
for x in (select name from v$parameter where name like 'optimizer%')
loop
dbms_output.put_line(x.name);
end loop;
end;
-------------------------------------------------------
optimizer_features_enable
optimizer_mode
optimizer_index_cost_adj
optimizer_index_caching
optimizer_dynamic_sampling
optimizer_ignore_hints
optimizer_secure_view_merging
optimizer_use_pending_statistics
optimizer_capture_sql_plan_baselines
optimizer_use_sql_plan_baselines
optimizer_use_invisible_indexes
optimizer_adaptive_reporting_only
optimizer_adaptive_plans
optimizer_inmemory_aware
optimizer_adaptive_statistics
optimizer_ignore_parallel_hints
----------------------------------------------------------



-- Enable timing of SQL statements
SET TIMING ON;

-- Enable autotrace for detailed execution plans
SET AUTOTRACE ON;

-- Set the threshold for identifying slow queries (adjust as needed)
ALTER SESSION SET STATISTICS_LEVEL = ALL;
ALTER SESSION SET TIMED_STATISTICS = TRUE;
ALTER SESSION SET SQL_TRACE = TRUE;

-- Your SQL query goes here
SELECT *
FROM your_table
WHERE your_condition;

-- Reset session settings
ALTER SESSION SET STATISTICS_LEVEL = TYPICAL;
ALTER SESSION SET TIMED_STATISTICS = FALSE;
ALTER SESSION SET SQL_TRACE = FALSE;

-- Disable timing of SQL statements
SET TIMING OFF;

-- Display execution plan
-- Uncomment the line below if you want to see the execution plan
-- SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL, NULL, 'ALLSTATS LAST'));

No comments:

Post a Comment

Enable OpenSSH on Windows 11

Step 1: Install OpenSSH Server You can do this via PowerShell (run as Administrator ): Check if it's already available: Get-WindowsCapab...