5
What is the advantage of maintaining an indexed database, with Foreign key and indexing of the most used fields as in searches?
5
What is the advantage of maintaining an indexed database, with Foreign key and indexing of the most used fields as in searches?
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 mysql sql database
You are not signed in. Login or sign up in order to post.
Related virtually duplicate (not because it has two questions in one): http://answall.com/q/35088/101 I voted to close as broad (if one would be duplicate, that’s the problem of broad question).
– Maniero
Related: When and in which columns should indexes be used?
– Jéf Bueno