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
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.