vizskywalker 0 Report post Posted October 10, 2005 I've been searching the MySQL documentatiopn, but I can't seem to find exactly what purpose indexes serve. I have a database that needs to be searchale by practically every column, and I don't know whether everything needs to be indexed, and if so how. Any information on the imprtance of indexes, and perhaps a small explanantion of the different kinds would be appreciated.Thanks~Viz Share this post Link to post Share on other sites
yordan 10 Report post Posted October 11, 2005 Indexes are they way the database accesses the single recond you need. If I need to know something about vizskywalker, if I have an index on "name", I do a single disk access to read the index, and the index tells me where to do the second disk access to have the info concerning vizskywalker. If I have no index, I will have to read the whole database everytime I want the info concerning vizskywalker. So, from a philosophy point of view, if you want to read the whole database everytime you want to display something on your screen, you need no index. If you want to read the enfo concerning somebody (vizskywalker for instance) and only this info, you need an index.So, if you want to have fast access to your data when asking for a name, you need to create an index on the "name" column. If you want to retrieve records concerning year of birth, the index has to be created on the year column. If you never do queries concerning "studies and hobbies", do not index the column named "studies_and_hobbies".hope this helped.Yordan Share this post Link to post Share on other sites
vizskywalker 0 Report post Posted October 11, 2005 So, query wise, how does a search for the record pertaining to 'yordan' vary depending on whether or not I have an index? I know without an index it would be: SELECT * FROM <table> WHERE `name`='yordan'(At least I think there are quotes around yordan.)~Viz Share this post Link to post Share on other sites