# Index Question

**URL:** <https://forums.percona.com/t/index-question/317>\
**Category:** Other MySQL® Questions\
**Created:** [May 11, 2007, 12:54pm UTC](https://forums.percona.com/t/index-question/317 "2007-05-11T12:54:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![esudnik](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@esudnik](https://forums.percona.com/u/esudnik)\
**Post date:** [May 11, 2007, 12:54pm UTC](https://forums.percona.com/t/index-question/317/1 "2007-05-11T12:54:50Z")

</div>

I have following index question:

First a have this table definition:

mytable

- id (pk)
- column1 (fk to any other table)
- column2  
index 1: id  
index 2: column1

…when a call this query, then it is not very fast because only one column index is used  
select \* from mytable where column1 = ?? order by column2

…then a changed mytable to this:  
mytable

- id (pk)
- column1 (fk)
- column2  
index 1: id  
index 2: column1, column2

in this table I created index with both columns and droped column1 index  
   
and now my question: is there any other performance problem when a do this?

---

<div class="post-metadata">

**Author:** ![shobana](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@shobana](https://forums.percona.com/u/shobana)\
**Post date:** [May 22, 2007, 2:22pm UTC](https://forums.percona.com/t/index-question/317/2 "2007-05-22T14:22:53Z")

</div>

Since you have only one where clause. It okay to index just one column(primary key).

Sort by happens after the query retrieval and this doesn’t depend on the index on foreign key column2.

Hence it wise to just have one index, unless you join with another table.

Regards  
Shobana
