views:

103

answers:

2

This is a multipart Indes question:

  1. Is there a way one can create index on index?
  2. Why would one wish to to so?
  3. And if so, are ther any examples?
+10  A: 

NO, Indexes are meant for COLUMNS IN TABLES

How MySQL Uses Indexes

Indexes are used to find rows with specific column values quickly. Without an index, MySQL must begin with the first row and then read through the entire table to find the relevant rows. The larger the table, the more this costs. If the table has an index for the columns in question, MySQL can quickly determine the position to seek to in the middle of the data file without having to look at all the data. If a table has 1,000 rows, this is at least 100 times faster than reading sequentially.

astander
how do I decide when it is appropriate create index or drop index? I have to access two columns frequently from table with 8 columns.(say some cases like table having have 1000 rows, 10000 rows, 1 million, 2-3 million , 5 million ). Is it always good to go with making index ? Do it ever become turn a bad idea to create index?
Indexes should be used when performace is terrible, not as a rule on a 10-1000 table. If you find the query to be slow, have a look at indexs. I have never seen a table with 10 rows perform badly, but joining to a bigger table (10,000,000) table might give you issues. So as the old saying goes, **Dont fix it if it aint broke**
astander
+3  A: 

You can see from syntax diagram for create index in the oracle documentation that it does not apply to indexes.
Nor can I think of a reason you would want to.

hamishmcn