954,148 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Indexing and Query optimisation.

Hi,
i am having a problem with indexing. In my database, one of my table have 3 foreign key references, All these fields are indexed by default. I need to create an index for a regular seach item. is there any problem regarding performance, if i combine the primary key and the field i mentioned above for indexing? Also if i am creating an index for a primary key separately will the performance degrade? MySql didnot show any error when i created an idex for a primary key.
But it showed a warning that there is an index for same field.
Please give me your suggestion regarding this

SubeeshBabu
Newbie Poster
4 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

Your primary key is already indexed by default. Creating a second index just wastes memory but should not decrease performance. If you want to know more on how MySQL handles indexes check out their documentation.

http://dev.mysql.com/doc/refman/5.0/en/mysql-indexes.html

And for query optimization maybe look at multi-column indexes if you are passing more than one condition.

jbcrawford
Newbie Poster
5 posts since Sep 2007
Reputation Points: 10
Solved Threads: 1
 

Your primary key is already indexed by default. Creating a second index just wastes memory but should not decrease performance. If you want to know more on how MySQL handles indexes check out their documentation.

http://dev.mysql.com/doc/refman/5.0/en/mysql-indexes.html

And for query optimization maybe look at multi-column indexes if you are passing more than one condition.


Thank you very much:icon_smile:

SubeeshBabu
Newbie Poster
4 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You