drop table tq84_tab;
create table tq84_tab (
id number,
val varchar2(20),
constraint tq84_tab_pk primary key(id)
);
Create a table to store the result of dbms_xplan.compare_plans to:
create table tq84_compared_plans(result clob);
Create two plans, one of which uses a hint that the primary key index is not used:
explain plan
set statement_id = 'without hint'
for
select * from tq84_tab where id = 5;
explain plan
set statement_id = 'with hint'
for
select /*+ no_index(t) */ * from tq84_tab t where id = 5;