Re: [Rails] One huge table or separate tables? design issue

2014-11-04 Thread Jason Fleetwood-Boldt
In the Rails world, what Scott wrote is basically right (bordering on insane). ActiveRecord really won't place nice with that kind of a design. Outside of the Rails world, Big Data and Reporting people do things like that (date stamping table names) for aggregate reporting. There are times

Re: [Rails] One huge table or separate tables? design issue

2014-10-15 Thread Yongbiao Long
I feel sorry to bother you all again here, but I still have a problem: How to deal with the daily created tables in rails? I googled around and found nothing. The daily created tables are named on the dates, their names are all different. I know how to create tables in a periodically executed

Re: [Rails] One huge table or separate tables? design issue

2014-10-15 Thread Scott Ribe
On Oct 15, 2014, at 8:44 AM, Yongbiao Long longyongb...@gmail.com wrote: How to deal with the daily created tables in rails? Don't do that. It's an unnormalized, broken, bordering-on-insane design. The date is an attribute of some entity that belongs in its own table, to which your other data

Re: [Rails] One huge table or separate tables? design issue

2014-10-15 Thread Colin Law
On 15 October 2014 15:44, Yongbiao Long longyongb...@gmail.com wrote: I feel sorry to bother you all again here, but I still have a problem: How to deal with the daily created tables in rails? I googled around and found nothing. The daily created tables are named on the dates, their names are

Re: [Rails] One huge table or separate tables? design issue

2014-10-12 Thread Vivek Sampara
Hi, Creating multiple tables is not the key to solve this problem. If your rows are higher than 10 million records, then you have to make sure you archive the older ( Unused ) rows or solve it through MASTER - SLAVE db approach. Ideally when you're worry about performance issues with databases ,

Re: [Rails] One huge table or separate tables? design issue

2014-10-12 Thread Colin Law
On 12 October 2014 02:32, Yongbiao Long longyongb...@gmail.com wrote: Hi, everyone, I've learned Rails(Web development) on my own for two months, and came to a situation like this: There are two tables A and B in my database. A 'has_many` B. For every user input, There is an entry in table

Re: [Rails] One huge table or separate tables? design issue

2014-10-12 Thread Yongbiao Long
On Sun, Oct 12, 2014 at 5:17 PM, Colin Law clan...@gmail.com wrote: Are you sure your basic design is appropriate? Having 100,000 associated records per user seems very high. Are you able to explain what is in those records in case an alternative can be suggested? Thank you Colin! I'm

Re: [Rails] One huge table or separate tables? design issue

2014-10-12 Thread Colin Law
On 12 October 2014 11:34, Yongbiao Long longyongb...@gmail.com wrote: On Sun, Oct 12, 2014 at 5:17 PM, Colin Law clan...@gmail.com wrote: Are you sure your basic design is appropriate? Having 100,000 associated records per user seems very high. Are you able to explain what is in those

Re: [Rails] One huge table or separate tables? design issue

2014-10-12 Thread Colin Law
On 12 October 2014 11:54, Colin Law clan...@gmail.com wrote: On 12 October 2014 11:34, Yongbiao Long longyongb...@gmail.com wrote: On Sun, Oct 12, 2014 at 5:17 PM, Colin Law clan...@gmail.com wrote: Are you sure your basic design is appropriate? Having 100,000 associated records per user

Re: [Rails] One huge table or separate tables? design issue

2014-10-12 Thread Jim Ruther Nill
you can also run a task that archives past dates to a duplicate table since you'll rarely need them. maybe you can keep 1 month data in the table that you're writing to. this way, you won't have to worry about the exponential growth of the table you're always accessing. On Sun, Oct 12, 2014 at

Re: [Rails] One huge table or separate tables? design issue

2014-10-12 Thread Yongbiao Long
On Sun, Oct 12, 2014 at 6:54 PM, Colin Law clan...@gmail.com wrote: The first point is that you should only add rows as seats are booked, use that fact that there is no row to indicate that there is no booking. Secondly, what is the date? Is that the date of the journey or the date of the

Re: [Rails] One huge table or separate tables? design issue

2014-10-12 Thread Yongbiao Long
On Sun, Oct 12, 2014 at 7:18 PM, Jim Ruther Nill jvn...@gmail.com wrote: you can also run a task that archives past dates to a duplicate table since you'll rarely need them. maybe you can keep 1 month data in the table that you're writing to. this way, you won't have to worry about the

Re: [Rails] One huge table or separate tables? design issue

2014-10-12 Thread Yongbiao Long
On Sun, Oct 12, 2014 at 7:28 PM, Yongbiao Long longyongb...@gmail.com wrote: I do it in this way because I have another table representing the number of left seats, and I think it's easier to update this table in my way(in this case, the number of leaf seats from 1-3, 1-2, 2-3 decreases by

Re: [Rails] One huge table or separate tables? design issue

2014-10-12 Thread Colin Law
On 12 October 2014 12:28, Yongbiao Long longyongb...@gmail.com wrote: On Sun, Oct 12, 2014 at 6:54 PM, Colin Law clan...@gmail.com wrote: The first point is that you should only add rows as seats are booked, use that fact that there is no row to indicate that there is no booking. Secondly,