Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

index question 1

Status
Not open for further replies.

k108

Programmer
Jul 20, 2005
230
US
If you are *only* ever doing a "SELECT * FROM table", is there any point to adding an index on the table? I would think not, but I am just checking.
 
Not unless you planned to do an order by, in which case a clustered index on the order by column(s) would mean it wouldnt have to do a sort on return.

Also you probably will get alot of speel about not using Select * - as it forces changes in code etc if new columns added and performance is slightly effected



"I'm living so far beyond my income that we may almost be said to be living apart
 
I would avoid using select * (as indicated) because of the potential of design changes.

If your select * from table ever does a filter by a parameter - you may want an index.

For example, select * from table where id = 12

But per your question, if it is limited to select * from table, kill the index. The advantage of not having an index is that you can write (insert) records generally much quicker into the table.

-jb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top