Jump to content

How should I set up my MySQL?


lpxxfaintxx

Recommended Posts

I have a database of the english dictionary. I was wondering how I should set up my db...

Should I make 1 table and insert all the words in there (a LOT of words)-- or should I make 26 tables, for each letter of the alphabet. Would the second choice make the queries run faster?

Thanks
Link to comment
https://forums.phpfreaks.com/topic/18416-how-should-i-set-up-my-mysql/
Share on other sites

I would think the second choice (26 tables) would be better, but that's just my opinion. My reasoning behind this is:

If you were to use one table, with hundreds of thousands of words... that'd be a big table, right? Well, just think... in order to query the results by letter, you would either have to a) create a 'first letter' column or b) pull all the results from the table and then check to see if they contain the correct first letter. Even if you were to use the 'first letter' column, you would still have to use extra processing by using WHERE first_letter='x' (where x is the letter).

So, if you were to use 26 separate tables, when you run your query you would just have to do it like normal. (SELECT * FROM letter_x ORDER BY word ASC) That's really quite simple, and I would think that it would be much faster. Especially with pagination.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.