vendredi 6 novembre 2015

use multiple general perpose queries or one specific query

I have a Web-App that control selling and buying of merchandise as well as stock and prices...

it is built with AngularJs, PHP and MySQL(PDO).

My Model has many General perpose query functions such as:

  • getShops()
  • getShopInfo(shopId)
  • GetItems(shopId)
  • GetSuppliers()

and many more...

now, i develop a Dashboard Page, to show statistics and Top-Level vision on things, containing f.e:

  • Number of active items
  • Number of Sold items + total sum
  • Current Debt to suppliers

and many more aggregations on the data.

My question is what option of the two:

Should i use many basic queries in my model, and aggregate the data Client-Side...
will this be bit more maintainable?

OR

Should i create a Specific Query to get exactly what data this dashboard needs.
probably performance will be better.

Aucun commentaire:

Enregistrer un commentaire