jdkealy
jdkealy

Reputation: 4907

Splitting a collection across tables in rails

I was wondering if someone could point me in the right direction about how to model the following:

I am storing twitter and facebook metrics inside a postgresql database. Our application can authorize many different facebook and twitter accounts and pull in all of each respective accounts' data daily. Intuitively, I could just have a table called "metrics", which would store both the facebook and twitter daily metrics for all accounts, however, I am worried that such a table would grow to an unusable size rather quickly. So I was wondering, would it be possible, and would it be advisable to dynamically generate a table based on the account type and the account. So, if I 15 different facebook accounts authorized and 10 different twitter accounts authorized, that this would result in 25 tables.

Is there an ORM that supports this? Does Active Record? Is this an advisable route to take?

Upvotes: 0

Views: 40

Answers (1)

Marlin Pierce
Marlin Pierce

Reputation: 10089

Many records in one table will perform better than multiple tables, and would be less hassle. Millions of records in one table will perform well when indexed, and able to use indexes.

This is not an advisable route.

Upvotes: 2

Related Questions