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):

  1. 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).
  2. 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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -