Search notes:

Oracle: ANALYZE TABLE

Most functionlity is superseded by DBMS_STATS

Although analyze table has quite a few options, it should only be used
The other functionality of analyze table is superseded by dbms_stats.

analyze table … list chained rows

create table tq84_chained_row_test (
  id    number,
  data_ varchar2(4000)
)
pctfree 10 -- default
;

create table chained_rows (
  owner_name         varchar2(30),
  table_name         varchar2(30),
  cluster_name       varchar2(30),
  partition_name     varchar2(30),
  subpartition_name  varchar2(30),
  head_rowid         rowid,
  analyze_timestamp  date
);


begin
  for i in 1 .. 100 loop
    insert into tq84_chained_row_test values (i, lpad('x', 500, 'x'));
  end loop;
end;
/
commit;


analyze table tq84_chained_row_test list chained rows;

select * from chained_rows;
--
-- No chained rows found.
--

update tq84_chained_row_test set data_ = lpad('y', 4000, 'y') where id in (37, 89);

analyze table tq84_chained_row_test list chained rows;


select t.id from tq84_chained_row_test t
where
  t.rowid in (select head_rowid from chained_rows);
--
--       ID
-- --------
--       37
--       89
--

drop table chained_rows          purge;
drop table tq84_chained_row_test purge;
Github repository oracle-patterns, path: /SQL/analyze/table/list-chained_rows.sql
The result of this command is inserted into a table named chained_rows. Such a table can be created with utlchain.sql.
Old data in chained_rows is not automatically purged by an analyze table … list chained command.
If the table chained_rows does not exist, Oracle will throw the ORA-01495: Chain row table not found. error message.

Index