Showing 1 changed files with 45 additions and 1 deletions
+45 -1
HealthProbe/Doc/04-project/Import-Optimization-Log.md
@@ -222,6 +222,50 @@ Conclusion: first-import reset is now clean and the unused-index removal produce
222 222
 a large measurable gain. SQLite insert remains dominant, but the main bottleneck
223 223
 has moved from about 14m38s to 10m11s.
224 224
 
225
+### 2026-06-02 First Import After Additional Index Removal
226
+
227
+Commit context: after `06ee6be` (`Drop additional import write indexes`). Source:
228
+user-provided diagnostic report with `previousSnapshotID: none`,
229
+`isChainStart: true`, and the same total record count as the previous clean run.
230
+
231
+This is a comparable first-import benchmark for removing
232
+`idx_sample_versions_time` and `idx_visibility_sample_open`.
233
+
234
+| Metric | Value |
235
+|--------|-------|
236
+| Wall clock | 12m 39s |
237
+| Summed metric total | 12m 39s |
238
+| Summed fetch | 43.8s |
239
+| Summed processing | 1m 35s |
240
+| Summed insert | 10m 07s |
241
+| Summed finalize | 10.1s |
242
+| Total records | 1,579,168 |
243
+| Heart Rate count | 922,450 |
244
+| Heart Rate total | 8m 08s |
245
+| Heart Rate fetch | 19.2s |
246
+| Heart Rate processing | 55.0s |
247
+| Heart Rate insert | 6m 44s |
248
+| Active Energy count | 348,701 |
249
+| Active Energy insert | 2m 07s |
250
+| Steps insert | 20.7s |
251
+| Walking + Running Distance insert | 18.2s |
252
+
253
+Comparison against the previous comparable first-import run (`3dd5f48` context):
254
+
255
+| Metric | Previous | Current | Change |
256
+|--------|----------|---------|--------|
257
+| Wall clock | 12m 43s | 12m 39s | -4s / -1% |
258
+| Summed insert | 10m 11s | 10m 07s | -4s / -1% |
259
+| Heart Rate insert | 6m 41s | 6m 44s | +3s / +1% |
260
+| Active Energy insert | 2m 09s | 2m 07s | -2s / -2% |
261
+| Steps insert | 21.6s | 20.7s | -0.9s / -4% |
262
+| Walking + Running Distance insert | 19.2s | 18.2s | -1.0s / -5% |
263
+
264
+Conclusion: removing these two extra indexes did not materially change first
265
+import performance. The small differences are within expected run-to-run noise.
266
+The larger first-import gain remains attributable to the earlier hot `samples`
267
+index removal plus clean reset conditions.
268
+
225 269
 ## Optimization Iterations
226 270
 
227 271
 | Date | Commit | Change | Result / Status |
@@ -242,7 +286,7 @@ has moved from about 14m38s to 10m11s.
242 286
 | 2026-06-02 | pending | Captured non-chain-start full-scan report after index removal. | Not comparable for first-import performance; reveals a separate full-scan/unchanged-sample write bottleneck. |
243 287
 | 2026-06-02 | `a281c51` | Stopped writing `verified` observation events for unchanged existing samples. | Awaiting comparable non-chain-start/full-scan report. Expected signal is lower `SummedInsertElapsed` and especially lower Heart Rate insert time when most rows are unchanged. |
244 288
 | 2026-06-02 | `3dd5f48` | Fortified scheduled test database reset with a disk marker and extra SQLite sidecar cleanup. | Real-device report confirmed reset produced `previousSnapshotID: none`, `isChainStart: true`, and a clean first-snapshot timeline. |
245
-| 2026-06-02 | pending | Removed unused `sample_versions(start_date, end_date)` and redundant `sample_visibility_ranges(sample_id, last_observation_id)` indexes. | Awaiting comparable first-import report. Expected signal is lower insert time because first import writes one sample version and one visibility range per record. |
289
+| 2026-06-02 | `06ee6be` | Removed unused `sample_versions(start_date, end_date)` and redundant `sample_visibility_ranges(sample_id, last_observation_id)` indexes. | Comparable first-import report was flat: wall clock 12m43s -> 12m39s and summed insert 10m11s -> 10m07s. Treat as no material performance change. |
246 290
 
247 291
 ## Current Diagnosis
248 292