Wednesday, July 10, 2013

database: Index and create index

What is table index? How do I create one?

This link below explains very well what table index is. Suggest to read it.
http://stackoverflow.com/questions/1108/how-does-database-indexing-work

"creating an index requires additional disk space, and that too many indexes can cause issues arising from the file systems size limits, careful thought must be used to select the correct fields to index."


"Since indexes are only used to speed up the searching for a matching field within the records, it stands to reason that indexing fields used only for output would be simply a waste of disk space and processing time when doing an insert or delete operation, and thus should be avoided."


The following sql is an example on how to create index:

CREATE UNIQUE INDEX IDX_DEPARTMENT ON DEPARTMENT (DEPARTMENT_CODE);

No comments:

Post a Comment