Thursday, April 25, 2019

Most efficient way to Count and Sum from child entities

Please help me find a way to make this efficient

The program has this entities:
Modules 1-N Submodules .
Submodules 1-N Segments .

Segments - each one is a row and have a column with Wordcount in it, also they possed 2 status - 0 = incomplete, 1 =complete

The wordcount is made when the segments are inserted into the database and stored in a column.

For Total Rows and Total Wordcount , i have added columns in the database in module and submodule and are populated when the module is added.

The thing is for an efficient way to have CompletedRows and CompletedWords when i load Modules List View and Submodules List View (to make progress bars maybe)

Module List should have a column with words completed/total and rows completed/ total

Submodule List should have a column with words completed/total and rows completed/ total

Assume i would have around 50k rows (segments ) per module . so perfomance is a must.

Option 1: IQueryable Childs.Count() of some sort and Childs.Sum
Option 2: Add Completed columns to tables in database with CRON jobs to update them or to have a stored proccedure / triggers in mysql .
Option 3?: Creating 2 views in mysql? have never done them but maybe they are right for the job?
Options suggested: None yet

Most efficient way to Count and Sum from child entities Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team