Multiple "identical" tables

Hi, there.
I was wondering if it’s possible to have one controller and view that
has multiple tables. Let say there are 10 schools. Each school has a
table to stores students’ info. So one Student controller with 10
tables. Is it possible or any workaround?
Thanks in advances.

Ichiro S. wrote:

Hi, there.
I was wondering if it’s possible to have one controller and view that
has multiple tables. Let say there are 10 schools. Each school has a
table to stores students’ info. So one Student controller with 10
tables. Is it possible or any workaround?

That’s a terrible setup. You should never have multiple identical
tables – instead, all you need is one table for all students.

Thanks in advances.

Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Marnen Laibow-Koser wrote:

Ichiro S. wrote:

Hi, there.
I was wondering if it’s possible to have one controller and view that
has multiple tables. Let say there are 10 schools. Each school has a
table to stores students’ info. So one Student controller with 10
tables. Is it possible or any workaround?

That’s a terrible setup. You should never have multiple identical
tables – instead, all you need is one table for all students.

Thanks in advances.

Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Thanks Maren.
When there are 30+ schools and each has 100k+ students, it’ll be a very
large table. That’s why I was thinking about breaking it into some
smaller tables.

Andreas S. wrote:

Ichiro S. wrote:

That’s why I was thinking about breaking it into some
smaller tables.

Don’t. A few 100k or million rows are nothing for a database. As long as
you set up an index for the school_id, splitting the students in
multiple tables has absolutely no advantage.

Right. If you must break the table (which you probably won’t even
need to do), then use your DB’s sharding features (such as MySQL’s MERGE
tables) so that it still functions like one huge table.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

I second everybody else here. Add an identifier for the school in your
table and you’ll be happier than with the setup you were going to use.

Ichiro S. wrote:

That’s why I was thinking about breaking it into some
smaller tables.

Don’t. A few 100k or million rows are nothing for a database. As long as
you set up an index for the school_id, splitting the students in
multiple tables has absolutely no advantage.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs