Good practice for making a profile page

Hi, I’m working on creating a social network site. On the profile page there are multiple widgets that display user information from different tables(some of which have foreign relationships with other tables). Anyone would like to share their experience on how to design this page and Active Record classes while minimizing the amount of processing and database connections? ::)

I would recommend putting a lot of columns in one table that cover the basics (name, email, website, etc). By doing this, you will put less load on the database since there are few joins (if any). When I built my first website, I got too caught up with db normalization that I often needed to join 16 tables to return a single doc ID. I don’t think a profile page will require more than 2/3 tables.

Got a lot of statistical data? I’d think that you’ll most likely profit from either data or fragment caching.

If you cannot find good caching dependencies, try to split the profile page up, so not everything will need to be loaded at once. You could even try to conceal that with the help of a little ajax ;)

Since a single user has one-to-many relationships with these tables, I have no choice but to split them up :(.

That sounds exactly what I need, but what would be the best approach to integrate dependency caching with active record?

That depends on the nature of those records. A good starting metric is the number of entries in the DB (that’s mostly fast to fetch. If not, your RDBMS sucks). Anotehr approach is to take the highest value of a last_updated field (should be covered by an index).

It might be more complex than that. Impossible to tell without knowledge of your database layout ::)

The tables that I have is like a user having multiple addresses, multiple schools. Then I have “Addresses” widget and “Schools” widget, which will display all rows in the table they’re associated with. O0