Personal tools
You are here: Home DB2 How To's How to alter an index on DB2
Navigation
Log in


Forgot your password?
 
Document Actions

How to alter an index on DB2

check, drop and create


1 - Check how many indexes your table has and what they are

db2 describe indexes for table <table_name> show detail

2 - To modify your current index, you need to drop and create your index

db2 alter table <tablename> drop constraint <constraint_name>
db2 drop index <index_name>

Creating ...

db2 alter table <tablename> add constraint <constraint_name> primary key(field1,...)
db2 "CREATE INDEX <index_name> ON <table_name> (col_name1, col_name2)"

Creating and update statistics

db2 "CREATE INDEX <index_name> ON <table_name> (col_name1, col_name2) COLLECT SAMPLED DETAILED STATISTICS"

Security Awareness
Would you like your company to implement gamification into your security awareness program?





Polls