Skip to content

Improve performance of PC2-TestData.sql#479

Merged
JoeProgrammer88 merged 2 commits intomainfrom
copilot/refactor-pc2-testdata-sql
Mar 12, 2026
Merged

Improve performance of PC2-TestData.sql#479
JoeProgrammer88 merged 2 commits intomainfrom
copilot/refactor-pc2-testdata-sql

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 12, 2026

SQL test data load was slow (30s+) due to per-row commits, repeated parse/compile cycles, and individual INSERT round-trips.

Changes

  • Single transaction: Wrapped all inserts in BEGIN TRANSACTION / COMMIT TRANSACTION — eliminates per-row auto-commit
  • Removed 2,751 GO statements: One GO per row meant SQL Server was parsing/compiling each insert as a separate batch
  • Multi-row VALUES batches: Grouped up to 100 rows per INSERT — reduces round-trips and transaction log writes
Table Rows INSERT statements (before → after)
Agency 900 900 → 9
AgencyAgencyCategory 1,758 1,758 → 18
AgencyCategory 72 72 → 1
CalendarEvents 3 3 → 1
People 11 11 → 1

File shrunk from 5,506 lines to 2,825 lines. All data values are preserved exactly.

Copilot Summary

Automated refactor — no logic changes, data-only.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Request] - Improve performance of PC2-TestData.sql</issue_title>
<issue_description>Is your feature request related to a problem? Please describe.
On some lower spec hardware, the test data script can take 30 seconds or more to run. While this may not be big deal if it only needs to be run one time, it is still frustrating.

Describe the solution you'd like
Refactor the sql to improve performance

Describe alternatives you've considered
N/A

Additional context
Possible performance improvements?
Single transaction - Eliminates per-row auto-commit
Remove GO per row - Eliminates per-batch parse/compile overhead
Multi-row VALUES - Reduces round-trips and logging
Disable indexes - Eliminates index maintenance during load

</issue_description>

Comments on the Issue (you are @copilot in this section)


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Co-authored-by: JoeProgrammer88 <7156063+JoeProgrammer88@users.noreply.github.com>
Copilot AI changed the title [WIP] [Request] Refactor PC2-TestData.sql for performance improvement Improve performance of PC2-TestData.sql Mar 12, 2026
Copilot AI requested a review from JoeProgrammer88 March 12, 2026 18:11
@JoeProgrammer88 JoeProgrammer88 marked this pull request as ready for review March 12, 2026 18:26
@JoeProgrammer88 JoeProgrammer88 merged commit bc86b28 into main Mar 12, 2026
1 check passed
@JoeProgrammer88 JoeProgrammer88 deleted the copilot/refactor-pc2-testdata-sql branch March 12, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Request] - Improve performance of PC2-TestData.sql

2 participants