Skip to content

Instantly share code, notes, and snippets.

@sytkov
Last active December 28, 2015 07:09
Show Gist options
  • Save sytkov/7462255 to your computer and use it in GitHub Desktop.
Save sytkov/7462255 to your computer and use it in GitHub Desktop.
Gather table stats
declare
v_owner varchar2(4000) := '?';
type t_varchar2_tab is table of varchar2(4000);
v_tables t_varchar2_tab := t_varchar2_tab(
'?',
'?'
);
begin
for i in 1..v_tables.count loop
dbms_stats.gather_table_stats(
ownname => v_owner,
tabname => v_tables(i),
estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => 'FOR ALL COLUMNS SIZE AUTO',
cascade => TRUE
);
end loop;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment