Index_demo data setup

In a number of posts about indexes I use a demo table with some indexes. Here is how it is created:

drop table index_demo;

create table index_demo as
  with engine as
    (select level l from dual connect by level<=1e5)
  select l n, round(l/100) d, mod(l, 100) m, dbms_random.string('l',25) s from engine;

prompt create indexes
create unique index index_demo_u_n on index_demo(n);
create index index_demo_n on index_demo(n);
create index index_demo_d on index_demo(d);
create index index_demo_m on index_demo(m);
create index index_demo_s on index_demo(s);

exec dbms_stats.gather_table_stats('MARTIJN', 
                                   'INDEX_DEMO',
                                   method_opt=>'for all columns size auto',
                                   cascade=>true);


-- BAsic table statistics

  NUM_ROWS LAST_ANALYZED           BLOCKS EMPTY_BLOCKS
---------- ------------------- ---------- ------------
    100000 2020-11-09 21:54:08        611            0

-- Basic index statistics
INDEX_NAME           UNIQUENES     BLEVEL LEAF_BLOCKS LAST_ANALYZED       DISTINCT_KEYS CLUSTERING_FACTOR
-------------------- --------- ---------- ----------- ------------------- ------------- -----------------
INDEX_DEMO_S         NONUNIQUE          1         516 2020-11-09 21:54:08        100000             99836
INDEX_DEMO_U_N       UNIQUE             1         208 2020-11-09 21:54:08        100000               593
INDEX_DEMO_D         NONUNIQUE          1         208 2020-11-09 21:54:08          1001               595
INDEX_DEMO_M         NONUNIQUE          1         196 2020-11-09 21:54:08           100             59268

Tags: ,

Leave a Reply

Your email address will not be published. Required fields are marked *