Changes between Version 3 and Version 4 of OtherDevelopments


Ignore:
Timestamp:
06/04/26 22:05:07 (11 days ago)
Author:
221296
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OtherDevelopments

    v3 v4  
    9090The index on enroll_date improves the yearly grouping operation because the report groups data by year.
    9191
     92Result without indexes:
     93
     94{{{
     95Seq Scan on quiz_attempt qa_1
     96Seq Scan on quiz q_1
     97Seq Scan on lesson l_1
     98Seq Scan on module m_1
     99Seq Scan on course c_1
     100
     101Planning Time: 3.565 ms
     102Execution Time: 202.790 ms
     103}}}
     104
     105# Before adding indexes, PostgreSQL used sequential scans on the main joined tables, especially on quiz_attempt, which contains 20000 test records. The query execution time was 202.790 ms.
     106
     107Result with indexes:
     108
     109{{{
     110Seq Scan on quiz_attempt qa_1
     111Seq Scan on quiz q_1
     112Seq Scan on lesson l_1
     113Seq Scan on module m_1
     114Seq Scan on course c_1
     115
     116Planning Time: 8.008 ms
     117Execution Time: 218.476 ms
     118}}}
     119
     120# After adding indexes, PostgreSQL still selected sequential scans for the main tables. This happened because the query aggregates almost all quiz_attempt records, so reading the whole table was cheaper than using indexes. The execution time increased slightly from 202.790 ms to 218.476 ms; these indexes did not improve this specific analytical query.
     121
    92122=== Scenario 2: Monthly Analysis of Course Activity, Completions, Instructor Involvement and Student Success ===
    93123
     
    160190
    161191These indexes reduce the amount of data PostgreSQL needs to scan when generating monthly reports.
     192
     193Result without indexes:
     194
     195{{{
     196Seq Scan on enrollment e
     197Seq Scan on course c
     198Hash Join
     199Merge Left Join
     200Sort
     201HashAggregate
     202
     203Planning Time: 5.537 ms
     204Execution Time: 87.215 ms
     205}}}
     206
     207Result њith indexes:
     208
     209{{{
     210Seq Scan on enrollment e
     211Seq Scan on course c
     212Hash Join
     213Merge Left Join
     214Sort
     215HashAggregate
     216
     217Planning Time: 6.799 ms
     218Execution Time: 111.731 ms
     219}}}
     220
     221# After adding indexes, PostgreSQL still selected sequential scans for the main tables. The query performs monthly aggregation over most of the enrollment and quiz_attempt records, so the planner estimated that sequential scanning was cheaper than using indexes. The execution time increased from 87.215 ms to 111.731 ms, therefore these indexes did not improve this specific analytical query.
    162222
    163223= Security and Protection Measures =