Kevin Jolan
Kevin Jolan

Reputation: 257

finding words in mysql huge database

So, i've never worked with a database this huge. We are talking about 200.000.000++ words that i want to be able to search through. How should i approach this? using the normal "where" statement would take 10+++ minutes, should i split up the database or something?

Any help would be great!

Upvotes: 0

Views: 78

Answers (2)

Amir
Amir

Reputation: 4111

You should use MySql FULLTEXT indexing. Use AlTER TABLE for create a FULLTEXT index on your desire column.

and from http://dev.mysql.com/doc/refman/5.1/en/alter-table.html

Full-text indexes can be used only with MyISAM tables. (In MySQL 5.6 and up, they can also be used with InnoDB tables.) Full-text indexes can be created only for CHAR, VARCHAR, or TEXT columns.

Upvotes: 1

mavili
mavili

Reputation: 3424

MySQL FULLTEXT indexes are quite useful when searching for words. You have to define the fields which contain the relevant text/character strings as indexes. Then you can use

SELECT * FROM table WHERE MATCH (text_index_field) AGAINST ('what you need to look for');

Upvotes: 1

Related Questions