I have to extract words from a lot of text files and check if they exist in this large wordnet database in phpmyadmin. Because of the looping and checking(mysql) it takes 3 to 4 minutes for executing.

Is there any way to optimize? Would increasing db buffer size help,;if yes then how to do that?