I have a postgres database with several million rows that runs a web application. The data is static: users do not write to it.
I would like to be able to offer users query-dependent aggregates (for example, the sum of all rows with a specific foreign key value), but the size of the database now means that it takes 10-15 minutes to calculate such aggregates.
Should I:
The only problem with 1. is that I don’t necessarily know what aggregate users will want, and this will obviously increase the size of the database even more.
If there was a better solution for such problems than postgres, then I would be very grateful for any suggestions.
You are trying to solve the problem of the OLAP (On-Line Analytical Process) database structure using the OLTP (On-Line Transactional Process) database structure.
You must create another set of tables that store only aggregates and update these tables in the middle of the night. Thus, your customers can query the aggregate set of tables and will not interfere with the transaction transaction system at all.
The only caveat is that aggregate data will always be one day behind.
, , ( , OR/M).
: , . (GL). . , , , . .
account_balance. ( , ) , GL , . , , , .
(- MyAggragatedResult), :
ResultsProxy { calculateResult (param1, param2) { .. .. , }
}
java /, .Net. ( ) ( ..).
Postgres.
- 10-15 " ". . , " " Postgres (, , ) . .
- OLAP, Mondrian . .
, (, , ) / , .
- . , .
, , - , .
, , , , , .
Oracle Query Rewrite. :
, (WHERE ID = val) , . - . FROM ... , , , , , .
, - . -, "", . , DAILY_SALES . , , .
, , , . Oracle . , MV MV Log . , DAILY_SALES , ORACLE , . .
, ... , .
Source: https://habr.com/ru/post/1771750/More articles:Creating jquery templates repeatedly - jqueryString processing EL enum - javaСлужба WCF терпит неудачу каждые 23 часа с "Время ожидания запроса на ожидание ответа после 00:01:00" - asp.netDRY without a single code? - language-agnosticThe parameter of type "POCO Class" in ExecuteFunction is incompatible with the type "EFComplexType" returned by the function - .netUnderstanding Additional JavaScript by Dean Edwards - javascriptJQuery UI Datepicker Adding Code Before - Deploying Layout - jqueryReturn the next localized countdown timer date - javascriptCodebehind access list from aspx page - c #win32 DialogBox app: how to make a dialog box hidden at startup? - winapiAll Articles