php and mysql question

Associate
Joined
26 Nov 2004
Posts
1,480
Location
Gran Canaria
Hi

One of my mysql tables is relatively small and mostly unchanging and is queried fairly intensively as a look up table for other much larger tables. It looks up id's for variations in spelling of a limited set of words. Is it worthwhile to store this small table to an array in php and access it from there, in order to save database queries? As I said, the table is pretty small containing only a couple of hundred or so rows and two columns.

Cheers in advance.
 
No, you've changing a small table, with a minimal access delay, into a massive array, which will be horrendous to manipulate.
 
Hmm. Well, the table will only be loaded into the array for reading.

To explain a little further, the table holds variations of spelling and abbreviation (tokens) for words, in order to further system comprehension of user input. If I load the table into the array where the token, when found, returns an index, it seems to me that this might be quicker and reduce db access.

For example:
------------------------
token | word_id
------------------------
car park | 23
parking lot | 23
-------------------------

Reiterating that there aren't that many of these tokens, but that the php will have to iterate through a block of text checking each word against the tokens and returning an id where found, is this not worthwhile?

Thanks for advice. :)
 
Thanks for the suggestion.

Looks really useful, but the queries involved aren't really consistent enough in my opinion.
 
Back
Top Bottom