Indexing of Database

Asked

Viewed 751 times

5

What is the advantage of maintaining an indexed database, with Foreign key and indexing of the most used fields as in searches?

1 answer

4


The difference can be analyzed using the explain.

try to query over a table, using a Where field. Then try putting an index in that field and pulling out, and seeing the differences. explain gives an explanation of what Mysql does when executing a query.

With the index, searches are accelerated, which only has a significant impact once these tables begin to have many records. The Foreign Keys have the same impact, and they also help in performance when making a Join between multiple tables.

In addition, the Foreign Keys allow you to define what should happen when you delete records from a given table, and your input is referenced in others. Lets you delete permissions from a given user if the permissions have a Foreign key for the user, and the corresponding user line is deleted.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.