If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > DB Design Question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-01-05, 17:44
meone meone is offline
Registered User
 
Join Date: Feb 2004
Posts: 8
DB Design Question

Let me give a little background to my question. I have a large amount of data, currently at around 15,000 Rows 60MBs, and it grows at the rate of about 4,000 rows (16MBs) a year. When the database was smaller I used to have just one table with everything in it. But at around 8,000 rows (32MBs) it was running too slow, even simple select statments took a long time to complete. So I divided the data up, made catagories and gave each catagory its own table, and everything worked fine.
The way it worked is that each row is a member of a catagory (catagories are defined in a seperate table), but now I have been asked to make it so that each row can be a member of more than one catagory.
Normally I would have made a table connect the catagoryID to the articleID from the one main table, but because I have all the articles spread out over different tables that won't work. I can't combine all the rows into one table again because it is too slow. I could add a table field in the connecting table that has the name of the table that contains the actual data, but that would require 2 sql statements to get the final data which i'd rather not do if i can avoid it. Does any one have any suggestions as to how i can design my tables so the information can be called with one sql statement without having to have all the rows in one table?
Reply With Quote
  #2 (permalink)  
Old 03-01-05, 21:30
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
"without having to have all the rows in one table"?

nope, sorry

15,000 rows is peanuts

15,000,000 rows is medium size

15,000,000,000 rows is large

probably you did not have the right indexes defined for your queries, which is why it was slow

splitting the data into separate tables was the wrong decision

unless you can bring them back together into one table, then you will have real trouble with your many-to-many category linkage

good luck
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 03-02-05, 17:35
meone meone is offline
Registered User
 
Join Date: Feb 2004
Posts: 8
Bringing them all back together isn't a problem if I can solve the speed issue. From past conversations I was told that my table size (60MB right now) was too much. Can you point me in the right direction as far as indexing so i can see if that will solve my problem? I currently just have a Primary key.
Reply With Quote
  #4 (permalink)  
Old 03-02-05, 17:39
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
there should be an index on every column in every table that is not already declared as a primary key and that is used in a join condition or a search condition
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 03-02-05, 19:23
meone meone is offline
Registered User
 
Join Date: Feb 2004
Posts: 8
Will try that thanks for the help
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On