Improve transaction list and report performance with four targeted query and index changes
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- csharp
- Lĩnh vực
- database, performance
Hướng nghiên cứu
Start with the list query in TransactionsController.cs, the report query in ReportsController.cs, and the report projection in TransfersReportViewModel.cs; read the shared _TransactionsTable.cshtml before changing its models or partials. Compare generated SQL and behavior for transactions with multiple transfers and metadata, then measure the proposed projections and covering index using the listed TEST ranges. Done means preserving filters and report contents while recording performance results and a reversible index migration plan.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Larger date ranges make the transaction list and downloadable transactions report slow or unusable on the DEVAR production instance. Reduce database reads, duplicated result rows, and application memory use through four targeted changes, preserving the existing filters, displayed values, and exports.
Read-only investigation on October 21, 2026 found:
- DEVAR has one team and one source, approximately 275,634 transactions, 1.16 million transfers, and 803,000 transaction metadata records. Its default date range is already seven days.
- Over the preceding 14 days, the main transaction list query averaged 13.4 seconds across 171 completed executions, peaked at 176 seconds, and recorded two aborted executions around 30 seconds.
- The downloadable report recorded a 26-second completion and two aborted executions, one at 30 seconds. The completed execution returned 33,267 joined rows and performed approximately 494,450 logical reads.
- Existing transaction-date and transfer-transaction indexes are present and used by the execution plans. Both queries still perform many lookups into full rows. Query Store shows substantial data-read waits, and Azure metrics show read-I/O utilization reaching 100%.
- The list loads every matching transaction and its transfers before rendering HTML. The report loads transfers and metadata and renders one table row per transfer. DataTables paginates the resulting HTML in the browser.
Implement and evaluate these four changes:
-
Split the downloadable report query and disable tracking. Add query-local
AsSplitQuery()andAsNoTracking(). The current generated SQL joins both transfers and metadata at the transaction level: four transfers and three metadata entries produce 12 intermediate rows. Fetching the collections separately should remove this multiplication. Keep this scoped to the report rather than changing the DbContext default. Verify behavior if transactions change between the separate reads. -
Calculate report totals and transfer counts once from the transfers already loaded. The current projection loads transfers and additionally issues correlated
SUMandCOUNTsubqueries over them. The stored plan shows repeated transfer reads and lookups. After materialization, calculate the credit-only total and transfer count from the loaded collection, preserving decimal precision and existing report semantics. -
Project only the fields needed by the list and report. Both paths currently retrieve full transfer entities, including unused legacy accounting fields. Introduce focused read models for the displayed transaction fields and required transfer fields. Preserve the transaction-description/debit-description fallback, credit totals, account strings, metadata formatting, transfer ordering, links, and hidden fields used by search or exports. Check other consumers before changing shared transaction-table models or partials.
-
Benchmark a covering transfer index alongside the smaller projections. Candidate:
Transfers(TransactionId) INCLUDE (Direction, Amount, Description, FinancialSegmentString). The existingIX_Transfers_TransactionIddoes not contain these displayed fields, so the current plans fetch them through additional table lookups. Confirm the final projected columns and execution plans before choosing the index definition. Measure read benefits, index size, and write overhead; avoid introducing a redundant index without evidence. A source/date composite index is lower priority for DEVAR because its single source adds little selectivity and the date index is already used.
Relevant code:
- Main transaction list query
- Downloadable report query
- Report projection, totals, and transfer count
- Shared transaction table
- EF Core split-query behavior and tradeoffs
Validate in TEST with representative DEVAR-scale data:
- Compare before/after query time, logical reads, returned SQL rows, and application memory for identical 7-, 30-, and 90-day ranges. Record first-observed and repeated timings separately.
- Confirm identical transaction and transfer counts, credit totals, descriptions, accounts, metadata, and export contents. Include transactions with multiple transfers and metadata entries.
- Preserve team authorization, tracking-number lookup behavior, merchant filters, and date-range boundaries.
- Verify generated SQL avoids the transfers/metadata cross product and repeated report aggregate subqueries, and confirm the candidate index helps the final query shape before retaining it.
- Provide a reversible index migration and rollback plan. Production application or schema changes require separate approval after TEST validation.
These are evidence-backed candidates, not measured improvements yet. Server-side pagination, server-generated exports, and Azure tier upgrades are separate work. The existing unbounded HTML response remains a scaling limit after these optimizations. This issue records the investigation and proposed scope; no implementation or production changes have been made.
- Ngôn ngữ chính
- C#
- Star
- 4
- Fork
- 2
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ucdavis/Sloth
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
-
Add System AdminCó thể làm lại được @jSylvestre đã nhận 126 ngày trước và không có pull request nào đang mở. Đang mởbug
-
Allow update from IAMĐang mởenhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
For searching meta dataĐang mởIdea
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
Disable V1 endpoints?Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
Tất cả issue của ucdavis/Sloth
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug IronPython Python 3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
pyrevitlabs/pyRevit#4184 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
yusei36/KeePassPasskey#66 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
🐛 bug 🕒 low effort good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
guibranco/Sankhya-SDK-dotnet#654 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
巫女のセリフに声を付けるĐang mởassets claude-proposal
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Fialuxe/MouthOfGod_System#358 ·
Maintainer thường phản hồi trong vòng 1 ngày