Page 1 of 1

mysql database and php reading

Posted: Sun Jul 29, 2007 5:03 pm
by spamyboy
I'm creating a dictionary script for my website and I'm just poundering, what if I would split all words by theyr first letter to difrent tables, would that optimise page loading ?
for e.g. if person searches for somekinde of word, script would take search query first letter and only then parse data from database.
Would that be better or I have missed anything while thinking?

Posted: Sun Jul 29, 2007 6:37 pm
by John Cartwright
keep them all in the same table. As long as you create the neccesary keys it should be fine.

Posted: Mon Jul 30, 2007 5:48 am
by spamyboy
by "neccesary keys" you mean ?, all I did is set PRIMARY ID and word as INDEX.

Posted: Mon Jul 30, 2007 5:19 pm
by nathanr
you can partial index in mysql as in add an index which only covers the first 2 chars for example.. however unless you running a live search via ajax then it's really of no consequence as you need to search for the whole word anyways.

probably the only way to speed things up is to make a unique index on the "word" column, then read it with a handle.
alternatively, have the whole table stored as a MEMORY table..