Monday, September 24, 2018

Key Fields or Index Fields in a Data Base Table

Key Fields or Index Fields are quite useful in a database table. They were meant to have permanent or fixed values throughout their record lifetime not until the record is deleted. Key Fields makes sure that every record unique. Aside from this the database is equipped with logic(search algorithm) which makes use of index fields to perform fast and efficient search and sorting functions. I remember at one point in my programmer career when still software I am supporting is still struggling to make a name in he industry, one of the the client's problem was the program was running extremely slow so I investigated and found out that several select statements were not using index fields in there search parameter. I am aware that the software is capable of creating customized indexes so I created customized indexes and the result was 80% faster.

With this basic idea of database concepts, programmers will be able to create a group of tables that are optimized in terms query and sorting speeds. It is a fundamental concept that should not be forgotten. Always remember that if a field is meant to be modified, do not use as index field. It is a mortal sin to do it. Everybody will lough at you.

What happens when it is unavoidable because there is a possibility that all key fields are the same except that modifiable field? The answer is record will not be saved in the database. That's when a serial number as key field will come to the rescue. It makes sure that every record entered in the table is unique. It is just a design tip.

Just expressing my thought, duhhh!!!