Jump to content

Archived

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

lpxxfaintxx

How should I set up my MySQL?

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
That really depends on what you're using it for... you do really want to query 13 different tables?

Share this post


Link to post
Share on other sites

×

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.