Q: searching over a huge database I am into some problems atm, that is, I have a database of some words, which is like 900,000 and what I am trying to do is, check whether a word is in it, and if yes, return another field in the row.
I get timedout when I do that.I know I can change the timeout, but what I actually want is to make it faster somehow if possible. My visitor wont like to wait 30+ secs to get what he is looking for.
I cant make 900,000k static files because I have inodes limit in the hosting.
So I am pretty much locked up, so any thing that I can do to make it better?
Table structure :
ID | Word | Otherword
CREATE TABLE `database` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `word` text COLLATE utf8_unicode_ci NOT NULL,
 `md5string` text COLLATE utf8_unicode_ci NOT NULL,
 PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=966277 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

Query:
mysql_query("SELECT otherword FROM table WHERE word='$word'");

Another query:
mysql_query("SELECT word FROM table WHERE otherword='$otherword'");

Main query (a file using GET)
$word = $_GET["word"];
echo $word;
$check = mysql_query("SELECT md5string FROM `database` WHERE word='$word'") or     die(mysql_error());
while (mysql_num_rows($check)>0)
{
$out = mysql_fetch_array($check);
$output = $out[0];
}


A: Add fulltex index and use MyIsam table if the searching is more then update.
Othervise add indexes as per the requirement.

A: Searching over 1 million rows in a MySQL database shouldn't be a problem providing you have a sensible index.
Try adding an index to your database, like this (assuming the word you're looking for is in a column on it's own):
ALTER TABLE your_word_table ADD KEY(word_column(32));

(editted to include key length since it turns out they're TEXT columns)

A: 1 million shouldnt be 30 secs. Can you give us your query and table structure?
Try using fulltext indizes for the fields.
Try tricks like defining a Search row with uppercase words only searching for uppercase etc.
ALTER TABLE  `database` ADD FULLTEXT (
 `word` , `md5string` );


A: This should make your lookups fast after it finishes. Updated to include how much of the column to index because these are text fields. 
ALTER TABLE `database` ADD INDEX word_idx (word (32)), ADD INDEX md5_idx(md5string (32))
Did you name your table "database"?  It's a reserved word in MySQL and will probably cause you some headaches....
