One query per request or one query only for N requests?

0

I honestly do not know if I'm asking a very obvious thing, which we look at and say like this: Obviously the dynamic query per request is better!

But come on ...

The application

We are talking about a web application in ASPNET.MVC 4.0, of indicators - style a dashboard. The size of the application I would say would be small / medium with Oracle database.

Scenery

I need to make N querys to display the bookmarks. However, the filters can be made in memory or directly in the bank. The point is, as we are talking about indicators, I have mathematical operations involved. That is, I need a result of type:

ID         Valor         Tipo

1          25560.00      1
2          2330.00       1
3          140.00        2
4          10.00         1
5          50.00         3
6          40.00         3
7          33.00         1

At the end of the day ... my request would be something like:

  • Show me a percentage of all IDs that have Type = 1
  • Show me a percentage of all IDs that have Type = 2
  • Show me a percentage of all IDs that have Type = 3
  • Question

    Which is better?

  • Make a request only by bringing all IDS with all Types, putting all the data inside the ViewBag, doing the mathematical operations via JS and also filtering the Type via JS?
  • Do all operations on the bank, display the consolidated information in the application and go to the bank as many times as required?
  • asked by anonymous 30.06.2016 / 21:25

    0 answers