Indices in primary key columns

2

I know that each case is a case, and that there are no ready rules about creating the indexes. In my case, since the primary key for each table in my database is used in wheres of my queries to the database, should I create an index for them? Or is the field set as the primary key already considered by default as an index? This is because, in PhpMyAdmin, when I create the index in the column already entered as the primary key, the message appears that there are equal indexes for the same column, something like this.

    
asked by anonymous 13.08.2016 / 04:04

1 answer

3
  

In my case, considering that the primary key for each table in my database is used in the wheres of my database queries, should I create an index for them?

The indication of the primary key automatically creates an index for it. There is no need to do anything else.

Make sure you are creating some unnecessary index.

    
13.08.2016 / 04:15