oracle - Adding new column and index to a table with a billion records -


i want add new column table billion records. speed select statement, need add new index contain column , pk column.

  1. how long take add new index in billion records table?
  2. the new column example [field], value 0,1,2,9. of record's 9. in select condition field=0 or field=1 or field=2 used, field=9 not used.

    for example in billion records table ,

    • field value 0 records:100,000;
    • field value 1 records:100,000;
    • field value 2 records:100,000;
    • field value 9 records:a billion-300,000
  3. should create index on column? if not, select sql contain condition field=0 slow return results?

if of values 9's can avoid including them in index with:

create index my_index on my_table (case column_name when 9 null else column_name end); 

then query on ...

select ...   ...  case column_name when 9 null else column_name end = 2 

... example.

the time taken time required scan entire table, sort 300,000 records go in index. faster parallel index build, of course.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -