简体   繁体   中英

How to design a database that can handle unknown reports?

I am working on a project which stores large amounts of data on multiple industries.

I have been tasked with designing the database schema.

I need to make the database schema flexible so it can handle complex reporting on the data.

For example,

what products are trending in industry x
what other companies have a similar product to my company
how is my company website different to x company website

There could be all sorts of reports. Right now everything is vague. But I know for sure the reports need to be fast.

Am I right in thinking my best path is to try to make as many association tables as I can? The idea being (for example) if the product table is linked to the industry table, it'll be relatively easy to get all products for a certain industry without having to go through joins on other tables to try to make a connection to the data.

This seems insane though. The schema will be so large and complex.

Please tell me if what I'm doing is correct or if there is some other known solution for this problem. Perhaps the solution is to hire a data scientist or DBA whose job is to do this sort of thing, rather than getting the programmer to do it.

Thank you.

I think getting these kinds of answers from a relational/operational database will be very difficult and the queries will be really slow. The best approach I think will be to create multidimensional data structures (in other words a data warehouse) where you will have flattened data which will be easier to query than a relational database. It will also have historical data for trend analysis.
If there is a need for complex statistical or predictive analysis, then the data scientists can use the data warehouse as their source.

Adding to Amit's answer above, the problem is that what you need from your transactional database is a heavily normalized association of facts for operational purposes. For an analytic side you want what are effectively tagged facts.

In other words what you want is a series of star schemas where you can add whatever associations you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM