Very complex database architecture, how to deal with it?

advertisements

I have worked on several rails applications and now I work on a very complex one, from the database side. A lots of nested models, several polymorphyc associations...

How you deal with that complexity ? How can I know that we are working in the good direction ? What about performance issues ?

Thansk for your opinions.


First of all, you need to estimate the performance of the queries that your application runs against the database. Then you can try to optimize the queries, for example, by adding some indexes. Maybe in some cases you will also need to consider denormalizing some data to get better performance.

Performance of the queries may also depend on your data size. If you have really big data set and queries are optimal, then you may consider introducing (distributed) caching. Or if data model allows that think of partitioning your database on several nodes to improve query performance.

But still the first step should be a setup of some SQL query performance monitoring.