java - How is it better to handle time-consuming / CPU intensive queries? -
suppose situation example have instance of sql server
(it not case is). , have java
applications using spring
stack.
there queries optimized still slow due complex logic of aggregating data.
i have several approaches in mind (those short-terms now):
- proceed tuning (like creating views) , implement jobs recalculate these data right in
sql server
example every 5 minutes , store in separate table. (yes not solution still). - implement kind of mechanism count / aggregate data in background. implement 1 part of lambda-architecture. i've looked @ apache spark , others.
under optimized means queries using correct indexes , 'tuned'.
i know not kind of question more proposals / discussions. still i'm questioned.
what better way handle situation based on above?
update #1
based on what can , can't indexed views ms sql server indexed view not way go not support count, min, max, top, outer joins, or few other keywords or elements. can’t modify underlying tables , columns. view created with schemabinding option.
update #2
after spending time on this. i've stopped materialized views in sake of simplicity.
so, different database engines have concept of materialized view. sql server has equivalent it's indexed views. these designed exact use case. consider these methods before "rolling own" materialized view.
Comments
Post a Comment