perf: optimize portfolio queries and workflows

This commit is contained in:
陈煜 committed 2026-10-02 12:44:07 +08:00
1 parent da98d02661
commit a7e0a0fe58
45 files changed
+4446 -637

No files matched your search

+366
View File
@@ -0,0 +1,366 @@
{
"phase": "final",
"node": "v24.21.0",
"results": [
{
"accounts": 1,
"revisionsPerAccount": 10000,
"baseline": [
{
"name": "old positions",
"medianMs": 182.84,
"bytes": 6097025,
"queries": 5
},
{
"name": "old overview",
"medianMs": 949.27,
"bytes": 38903,
"queries": 4
}
],
"optimized": [
{
"name": "new positions",
"medianMs": 2.67,
"bytes": 368,
"queries": 5
},
{
"name": "new current overview",
"medianMs": 2.42,
"bytes": 316,
"queries": 5
},
{
"name": "new history page",
"medianMs": 21.32,
"bytes": 16462,
"queries": 5
},
{
"name": "new trend",
"medianMs": 51.91,
"bytes": 13485,
"queries": 7
}
],
"httpResults": [
{
"name": "HTTP positions",
"medianMs": 11.59,
"bytes": 368,
"queries": 0
},
{
"name": "HTTP overview",
"medianMs": 7.36,
"bytes": 354,
"queries": 0
},
{
"name": "HTTP history",
"medianMs": 19.2,
"bytes": 16462,
"queries": 0
},
{
"name": "HTTP trend",
"medianMs": 54.64,
"bytes": 13585,
"queries": 0
}
],
"baselineHttp": [
{
"name": "old HTTP positions",
"medianMs": 288.13,
"bytes": 6097025,
"queries": 0
},
{
"name": "old HTTP overview",
"medianMs": 992.35,
"bytes": 38920,
"queries": 0
}
],
"nestedSql": [
"SELECT `worthpath`.`Position`.`id`, `worthpath`.`Position`.`importedFromId`, `worthpath`.`Position`.`userId`, `worthpath`.`Position`.`kind`, `worthpath`.`Position`.`side`, `worthpath`.`Position`.`name`, `worthpath`.`Position`.`category`, `worthpath`.`Position`.`currency`, `worthpath`.`Position`.`notes`, `worthpath`.`Position`.`archived`, `worthpath`.`Position`.`hidden`, `worthpath`.`Position`.`createdAt`, `worthpath`.`Position`.`updatedAt`, `worthpath`.`Position`.`iconId` FROM `worthpath`.`Position` WHERE `worthpath`.`Position`.`userId` = ?",
"SELECT `worthpath`.`Revision`.`id`, `worthpath`.`Revision`.`sequence`, `worthpath`.`Revision`.`positionId`, `worthpath`.`Revision`.`amount`, `worthpath`.`Revision`.`effectiveDate`, `worthpath`.`Revision`.`notes`, `worthpath`.`Revision`.`reason`, `worthpath`.`Revision`.`createdAt`, `worthpath`.`Revision`.`updatedAt` FROM `worthpath`.`Revision` WHERE `worthpath`.`Revision`.`positionId` IN (?) ORDER BY `worthpath`.`Revision`.`effectiveDate` DESC, `worthpath`.`Revision`.`sequence` DESC LIMIT ? OFFSET ?"
],
"latestPlan": [
{
"f0": "-> Limit: 1 row(s) (cost=0.71 rows=1) (actual time=0.0158..0.0158 rows=1 loops=1)\n -> Index range scan on r using Revision_positionId_effectiveDate_sequence_idx over (positionId = '48c0ee00-069d-4443-9274-1d454c986c33' AND effectiveDate < '2026-10-02 16:00:00.000') (reverse), with index condition: ((r.positionId = '48c0ee00-069d-4443-9274-1d454c986c33') and (r.effectiveDate < TIMESTAMP'2026-10-02 16:00:00')) (cost=0.71 rows=1) (actual time=0.0153..0.0153 rows=1 loops=1)\n"
}
],
"pagePlan": [
{
"f0": "-> Append (cost=0..0 rows=51) (actual time=0.519..6.4 rows=51 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.519..0.519 rows=1 loops=1)\n -> Rows fetched before execution (cost=0..0 rows=1) (actual time=40e-6..70e-6 rows=1 loops=1)\n -> Select #2 (subquery in projection; run only once)\n -> Limit: 1 row(s) (cost=2252 rows=1) (actual time=0.514..0.514 rows=1 loops=1)\n -> Index range scan on x using Revision_positionId_effectiveDate_sequence_idx over (positionId = '48c0ee00-069d-4443-9274-1d454c986c33' AND effectiveDate < '2026-10-01 16:00:00.000') OR (positionId = '48c0ee00-069d-4443-9274-1d454c986c33' AND effectiveDate = '2026-10-01 16:00:00.000' AND sequence < 340720) (reverse), with index condition: ((x.positionId = '48c0ee00-069d-4443-9274-1d454c986c33') and ((x.effectiveDate < TIMESTAMP'2026-10-01 16:00:00') or ((x.effectiveDate = TIMESTAMP'2026-10-01 16:00:00') and (x.sequence < 340720)))) (cost=2252 rows=5004) (actual time=0.513..0.513 rows=1 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.148..0.148 rows=1 loops=1)\n -> Rows fetched before execution (cost=0..0 rows=1) (actual time=40e-6..60e-6 rows=1 loops=1)\n -> Select #4 (subquery in projection; run only once)\n -> Limit: 1 row(s) (cost=2302 rows=1) (actual time=0.145..0.145 rows=1 loops=1)\n -> Index range scan on x using Revision_positionId_effectiveDate_sequence_idx over (positionId = '48c0ee00-069d-4443-9274-1d454c986c33' AND effectiveDate < '2026-09-30 16:00:00.000') OR (positionId = '48c0ee00-069d-4443-9274-1d454c986c33' AND effectiveDate = '2026-09-30 16:00:00.000' AND sequence < 340719) (reverse), with index condition: ((x.positionId = '48c0ee00-069d-4443-9274-1d454c986c33') and ((x.effectiveDate < TIMESTAMP'2026-09-30 16:00:00') or ((x.effectiveDate = TIMESTAMP'2026-09-30 16:00:00') and (x.sequence < 340719)))) (cost=2302 rows=5114) (actual time=0.145..0.145 rows=1 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.141..0.141 rows=1 loops=1)\n -> Rows fetched before execution (cost=0..0 rows=1) (actual time=40e-6..60e-6 rows=1 loops=1)\n -> Select #6 (subquery in projection; run only once)\n -> Limit: 1 row(s) (cost=2301 rows=1) (actual time=0.139..0.139 rows=1 loops=1)\n -> Index range scan on x using Revision_positionId_effectiveDate_sequence_idx over (positionId = '48c0ee00-069d-4443-9274-1d454c986c33' AND effectiveDate < '2026-09-30 16:00:00.000') OR (positionId = '48c0ee00-069d-4443-9274-1d454c986c33' AND effectiveDate = '2026-09-30 16:00:00.000' AND sequence < 340718) (reverse), with index condition: ((x.positionId = '48c0ee00-069d-4443-9274-1d454c986c33') and ((x.effectiveDate < TIMESTAMP'2026-09-30 16:00:00') or ((x.effectiveDate = TIMESTAMP'2026-09-30 16:00:00') and (x.sequence < 340718)))) (cost=2301 rows=5113) (actual time=0.139..0.139 rows=1 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.146..0.146 rows=1 loops=1)\n -> Rows fetched before execution (cost=0..0 rows=1) (actual time=40e-6..60e-6 rows=1 loops=1)\n -> Select #8 (subquery in projection; run only once)\n -> Limit: 1 row(s) (cost=2301 rows=1) (actual time=0.144..0.144 rows=1 loops=1)\n -> Index range scan on x using Revision_positionId_effectiveDate_sequence_idx over (positionId = '48c0ee00-069d-4443-9274-1d454c986c33' AND effectiveDate < '2026-09-30 16:00:00.000') OR (positionId = '48c0ee00-069d-4443-9274-1d454c986c33' AND effectiveDate = '2026-09-30 16:00:00.000' AND sequence < 340717) (reverse), with index condition: ((x.positionId = '48c0ee00-069d-4443-9274-1d454c986c33') and ((x.effectiveDate < TIMESTAMP'2026-09-30 16:00:00') or ((x.effectiveDate = TIMESTAMP'2026-09-30 16:00:00') and (x.sequence < 340717)))) (cost=2301 rows=5112) (actual time=0.144..0.144 rows=1 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.136..0.136 rows=1 loops=1)\n -> Rows fetched before execution (cost=0..0 rows=1) (actual time=60e-6..80e-6 rows=1 loops=1)\n -> Select #10 (subquery in projection; run only once)\n -> Limit: 1 row(s) (cost=2300 rows=1) (actual time=0.134..0.134 rows=1 loops=1)\n -> Index range scan on x using Revision_positionId_effectiveDate_sequence_idx over (positionId = '48c0ee00-069d-4443-9274-1d454c986c33' AND effectiveDate < '2026-09-30 16:00:00.000') OR (positionId = '48c0ee00-069d-4443-9274-1d454c986c33' AND effectiveDate = '2026-09-30 16:00:00.000' AND sequence < 340716) (reverse), with index condition: ((x.positionId = '48c0ee00-069d-4443-9274-1d454c986c33') and ((x.effectiveDate < TIMESTAMP'2026-09-30 16:00:00') or ((x.effectiveDate = TIMESTAMP'2026-09-30 16:00:00') and (x.sequence < 340716)))) (cost=2300 rows=5111) (actual time=0.134..0.134 rows=1 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.134..0.134 rows=1 loops=1)Line truncated
}
],
"candidatePlans": [
[
{
"f0": "-> Limit: 51 row(s) (cost=501 rows=51) (actual time=0.0183..0.111 rows=51 loops=1)\n -> Index lookup on Revision using Revision_positionId_effectiveDate_sequence_idx (positionId='48c0ee00-069d-4443-9274-1d454c986c33') (reverse) (cost=501 rows=5003) (actual time=0.0179..0.108 rows=51 loops=1)\n"
}
]
]
},
{
"accounts": 1,
"revisionsPerAccount": 100000,
"baseline": [
{
"name": "old positions",
"medianMs": 2240.74,
"bytes": 61267028,
"queries": 5
},
{
"name": "old overview",
"medianMs": 10619.53,
"bytes": 39395,
"queries": 4
}
],
"optimized": [
{
"name": "new positions",
"medianMs": 2.74,
"bytes": 370,
"queries": 5
},
{
"name": "new current overview",
"medianMs": 2.13,
"bytes": 320,
"queries": 5
},
{
"name": "new history page",
"medianMs": 33.3,
"bytes": 16562,
"queries": 5
},
{
"name": "new trend",
"medianMs": 587.94,
"bytes": 13754,
"queries": 7
}
],
"httpResults": [
{
"name": "HTTP positions",
"medianMs": 5.56,
"bytes": 370,
"queries": 0
},
{
"name": "HTTP overview",
"medianMs": 5.39,
"bytes": 358,
"queries": 0
},
{
"name": "HTTP history",
"medianMs": 38.5,
"bytes": 16562,
"queries": 0
},
{
"name": "HTTP trend",
"medianMs": 585.14,
"bytes": 13854,
"queries": 0
}
],
"baselineHttp": [
{
"name": "old HTTP positions",
"medianMs": 2826.9,
"bytes": 61267028,
"queries": 0
},
{
"name": "old HTTP overview",
"medianMs": 9885.51,
"bytes": 39412,
"queries": 0
}
],
"nestedSql": [
"SELECT `worthpath`.`Position`.`id`, `worthpath`.`Position`.`importedFromId`, `worthpath`.`Position`.`userId`, `worthpath`.`Position`.`kind`, `worthpath`.`Position`.`side`, `worthpath`.`Position`.`name`, `worthpath`.`Position`.`category`, `worthpath`.`Position`.`currency`, `worthpath`.`Position`.`notes`, `worthpath`.`Position`.`archived`, `worthpath`.`Position`.`hidden`, `worthpath`.`Position`.`createdAt`, `worthpath`.`Position`.`updatedAt`, `worthpath`.`Position`.`iconId` FROM `worthpath`.`Position` WHERE `worthpath`.`Position`.`userId` = ?",
"SELECT `worthpath`.`Revision`.`id`, `worthpath`.`Revision`.`sequence`, `worthpath`.`Revision`.`positionId`, `worthpath`.`Revision`.`amount`, `worthpath`.`Revision`.`effectiveDate`, `worthpath`.`Revision`.`notes`, `worthpath`.`Revision`.`reason`, `worthpath`.`Revision`.`createdAt`, `worthpath`.`Revision`.`updatedAt` FROM `worthpath`.`Revision` WHERE `worthpath`.`Revision`.`positionId` IN (?) ORDER BY `worthpath`.`Revision`.`effectiveDate` DESC, `worthpath`.`Revision`.`sequence` DESC LIMIT ? OFFSET ?"
],
"latestPlan": [
{
"f0": "-> Limit: 1 row(s) (cost=0.71 rows=1) (actual time=0.0203..0.0203 rows=1 loops=1)\n -> Index range scan on r using Revision_positionId_effectiveDate_sequence_idx over (positionId = 'd4a20795-cbba-4260-8958-1a19c3fd49de' AND effectiveDate < '2026-10-02 16:00:00.000') (reverse), with index condition: ((r.positionId = 'd4a20795-cbba-4260-8958-1a19c3fd49de') and (r.effectiveDate < TIMESTAMP'2026-10-02 16:00:00')) (cost=0.71 rows=1) (actual time=0.0198..0.0198 rows=1 loops=1)\n"
}
],
"pagePlan": [
{
"f0": "-> Append (cost=0..0 rows=51) (actual time=0.634..35.5 rows=51 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.634..0.634 rows=1 loops=1)\n -> Rows fetched before execution (cost=0..0 rows=1) (actual time=40e-6..70e-6 rows=1 loops=1)\n -> Select #2 (subquery in projection; run only once)\n -> Limit: 1 row(s) (cost=22711 rows=1) (actual time=0.626..0.626 rows=1 loops=1)\n -> Index range scan on x using Revision_positionId_effectiveDate_sequence_idx over (positionId = 'd4a20795-cbba-4260-8958-1a19c3fd49de' AND effectiveDate < '2026-10-01 16:00:00.000') OR (positionId = 'd4a20795-cbba-4260-8958-1a19c3fd49de' AND effectiveDate = '2026-10-01 16:00:00.000' AND sequence < 440721) (reverse), with index condition: ((x.positionId = 'd4a20795-cbba-4260-8958-1a19c3fd49de') and ((x.effectiveDate < TIMESTAMP'2026-10-01 16:00:00') or ((x.effectiveDate = TIMESTAMP'2026-10-01 16:00:00') and (x.sequence < 440721)))) (cost=22711 rows=50467) (actual time=0.625..0.625 rows=1 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.511..0.511 rows=1 loops=1)\n -> Rows fetched before execution (cost=0..0 rows=1) (actual time=40e-6..60e-6 rows=1 loops=1)\n -> Select #4 (subquery in projection; run only once)\n -> Limit: 1 row(s) (cost=23215 rows=1) (actual time=0.506..0.506 rows=1 loops=1)\n -> Index range scan on x using Revision_positionId_effectiveDate_sequence_idx over (positionId = 'd4a20795-cbba-4260-8958-1a19c3fd49de' AND effectiveDate < '2026-09-30 16:00:00.000') OR (positionId = 'd4a20795-cbba-4260-8958-1a19c3fd49de' AND effectiveDate = '2026-09-30 16:00:00.000' AND sequence < 440720) (reverse), with index condition: ((x.positionId = 'd4a20795-cbba-4260-8958-1a19c3fd49de') and ((x.effectiveDate < TIMESTAMP'2026-09-30 16:00:00') or ((x.effectiveDate = TIMESTAMP'2026-09-30 16:00:00') and (x.sequence < 440720)))) (cost=23215 rows=51588) (actual time=0.505..0.505 rows=1 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.497..0.497 rows=1 loops=1)\n -> Rows fetched before execution (cost=0..0 rows=1) (actual time=40e-6..60e-6 rows=1 loops=1)\n -> Select #6 (subquery in projection; run only once)\n -> Limit: 1 row(s) (cost=23215 rows=1) (actual time=0.493..0.493 rows=1 loops=1)\n -> Index range scan on x using Revision_positionId_effectiveDate_sequence_idx over (positionId = 'd4a20795-cbba-4260-8958-1a19c3fd49de' AND effectiveDate < '2026-09-30 16:00:00.000') OR (positionId = 'd4a20795-cbba-4260-8958-1a19c3fd49de' AND effectiveDate = '2026-09-30 16:00:00.000' AND sequence < 440719) (reverse), with index condition: ((x.positionId = 'd4a20795-cbba-4260-8958-1a19c3fd49de') and ((x.effectiveDate < TIMESTAMP'2026-09-30 16:00:00') or ((x.effectiveDate = TIMESTAMP'2026-09-30 16:00:00') and (x.sequence < 440719)))) (cost=23215 rows=51587) (actual time=0.493..0.493 rows=1 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.436..0.436 rows=1 loops=1)\n -> Rows fetched before execution (cost=0..0 rows=1) (actual time=50e-6..70e-6 rows=1 loops=1)\n -> Select #8 (subquery in projection; run only once)\n -> Limit: 1 row(s) (cost=23214 rows=1) (actual time=0.432..0.432 rows=1 loops=1)\n -> Index range scan on x using Revision_positionId_effectiveDate_sequence_idx over (positionId = 'd4a20795-cbba-4260-8958-1a19c3fd49de' AND effectiveDate < '2026-09-30 16:00:00.000') OR (positionId = 'd4a20795-cbba-4260-8958-1a19c3fd49de' AND effectiveDate = '2026-09-30 16:00:00.000' AND sequence < 440718) (reverse), with index condition: ((x.positionId = 'd4a20795-cbba-4260-8958-1a19c3fd49de') and ((x.effectiveDate < TIMESTAMP'2026-09-30 16:00:00') or ((x.effectiveDate = TIMESTAMP'2026-09-30 16:00:00') and (x.sequence < 440718)))) (cost=23214 rows=51586) (actual time=0.432..0.432 rows=1 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.424..0.424 rows=1 loops=1)\n -> Rows fetched before execution (cost=0..0 rows=1) (actual time=40e-6..60e-6 rows=1 loops=1)\n -> Select #10 (subquery in projection; run only once)\n -> Limit: 1 row(s) (cost=23214 rows=1) (actual time=0.421..0.421 rows=1 loops=1)\n -> Index range scan on x using Revision_positionId_effectiveDate_sequence_idx over (positionId = 'd4a20795-cbba-4260-8958-1a19c3fd49de' AND effectiveDate < '2026-09-30 16:00:00.000') OR (positionId = 'd4a20795-cbba-4260-8958-1a19c3fd49de' AND effectiveDate = '2026-09-30 16:00:00.000' AND sequence < 440717) (reverse), with index condition: ((x.positionId = 'd4a20795-cbba-4260-8958-1a19c3fd49de') and ((x.effectiveDate < TIMESTAMP'2026-09-30 16:00:00') or ((x.effectiveDate = TIMESTAMP'2026-09-30 16:00:00') and (x.sequence < 440717)))) (cost=23214 rows=51585) (actual time=0.421..0.421 rows=1 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.492..0.492Line truncated
}
],
"candidatePlans": [
[
{
"f0": "-> Limit: 51 row(s) (cost=6160 rows=51) (actual time=0.0321..0.211 rows=51 loops=1)\n -> Index lookup on Revision using Revision_positionId_effectiveDate_sequence_idx (positionId='d4a20795-cbba-4260-8958-1a19c3fd49de') (reverse) (cost=6160 rows=50466) (actual time=0.0313..0.208 rows=51 loops=1)\n"
}
]
]
},
{
"accounts": 10,
"revisionsPerAccount": 10000,
"baseline": [
{
"name": "old positions",
"medianMs": 2091.34,
"bytes": 60970241,
"queries": 5
},
{
"name": "old overview",
"medianMs": 16928.24,
"bytes": 199599,
"queries": 5
}
],
"optimized": [
{
"name": "new positions",
"medianMs": 4.17,
"bytes": 3671,
"queries": 5
},
{
"name": "new current overview",
"medianMs": 2.98,
"bytes": 2100,
"queries": 5
},
{
"name": "new history page",
"medianMs": 39.58,
"bytes": 16471,
"queries": 14
},
{
"name": "new trend",
"medianMs": 582.64,
"bytes": 13755,
"queries": 7
}
],
"httpResults": [
{
"name": "HTTP positions",
"medianMs": 6.19,
"bytes": 3671,
"queries": 0
},
{
"name": "HTTP overview",
"medianMs": 5.48,
"bytes": 2138,
"queries": 0
},
{
"name": "HTTP history",
"medianMs": 34.32,
"bytes": 16471,
"queries": 0
},
{
"name": "HTTP trend",
"medianMs": 568.12,
"bytes": 13855,
"queries": 0
}
],
"baselineHttp": [
{
"name": "old HTTP positions",
"medianMs": 2869.42,
"bytes": 60970241,
"queries": 0
},
{
"name": "old HTTP overview",
"medianMs": 15636.96,
"bytes": 199616,
"queries": 0
}
],
"nestedSql": [
"SELECT `worthpath`.`Position`.`id`, `worthpath`.`Position`.`importedFromId`, `worthpath`.`Position`.`userId`, `worthpath`.`Position`.`kind`, `worthpath`.`Position`.`side`, `worthpath`.`Position`.`name`, `worthpath`.`Position`.`category`, `worthpath`.`Position`.`currency`, `worthpath`.`Position`.`notes`, `worthpath`.`Position`.`archived`, `worthpath`.`Position`.`hidden`, `worthpath`.`Position`.`createdAt`, `worthpath`.`Position`.`updatedAt`, `worthpath`.`Position`.`iconId` FROM `worthpath`.`Position` WHERE `worthpath`.`Position`.`userId` = ?",
"SELECT `worthpath`.`Revision`.`id`, `worthpath`.`Revision`.`sequence`, `worthpath`.`Revision`.`positionId`, `worthpath`.`Revision`.`amount`, `worthpath`.`Revision`.`effectiveDate`, `worthpath`.`Revision`.`notes`, `worthpath`.`Revision`.`reason`, `worthpath`.`Revision`.`createdAt`, `worthpath`.`Revision`.`updatedAt` FROM `worthpath`.`Revision` WHERE `worthpath`.`Revision`.`positionId` IN (?,?,?,?,?,?,?,?,?,?) ORDER BY `worthpath`.`Revision`.`effectiveDate` DESC, `worthpath`.`Revision`.`sequence` DESC"
],
"latestPlan": [
{
"f0": "-> Append (cost=87744 rows=10) (actual time=0.0191..0.113 rows=10 loops=1)\n -> Stream results (cost=8960 rows=1) (actual time=0.0187..0.0188 rows=1 loops=1)\n -> Limit: 1 row(s) (cost=8960 rows=1) (actual time=0.016..0.0161 rows=1 loops=1)\n -> Index range scan on r using Revision_positionId_effectiveDate_sequence_idx over (positionId = 'abe0b945-e334-4020-8d28-1d4e03266739' AND effectiveDate < '2026-10-02 16:00:00.000') (reverse), with index condition: ((r.positionId = 'abe0b945-e334-4020-8d28-1d4e03266739') and (r.effectiveDate < TIMESTAMP'2026-10-02 16:00:00')) (cost=8960 rows=19910) (actual time=0.0155..0.0155 rows=1 loops=1)\n -> Stream results (cost=8960 rows=1) (actual time=0.0115..0.0116 rows=1 loops=1)\n -> Limit: 1 row(s) (cost=8960 rows=1) (actual time=0.0102..0.0102 rows=1 loops=1)\n -> Index range scan on r using Revision_positionId_effectiveDate_sequence_idx over (positionId = '7a7b7ab6-2d18-4ddc-87d5-b7d673d03616' AND effectiveDate < '2026-10-02 16:00:00.000') (reverse), with index condition: ((r.positionId = '7a7b7ab6-2d18-4ddc-87d5-b7d673d03616') and (r.effectiveDate < TIMESTAMP'2026-10-02 16:00:00')) (cost=8960 rows=19910) (actual time=0.01..0.01 rows=1 loops=1)\n -> Stream results (cost=8225 rows=1) (actual time=0.00945..0.00951 rows=1 loops=1)\n -> Limit: 1 row(s) (cost=8225 rows=1) (actual time=0.00863..0.00865 rows=1 loops=1)\n -> Index range scan on r using Revision_positionId_effectiveDate_sequence_idx over (positionId = '928ec1d9-dfe2-4636-af8c-9ef882778826' AND effectiveDate < '2026-10-02 16:00:00.000') (reverse), with index condition: ((r.positionId = '928ec1d9-dfe2-4636-af8c-9ef882778826') and (r.effectiveDate < TIMESTAMP'2026-10-02 16:00:00')) (cost=8225 rows=18278) (actual time=0.00854..0.00854 rows=1 loops=1)\n -> Stream results (cost=8960 rows=1) (actual time=0.00986..0.00992 rows=1 loops=1)\n -> Limit: 1 row(s) (cost=8960 rows=1) (actual time=0.00918..0.0092 rows=1 loops=1)\n -> Index range scan on r using Revision_positionId_effectiveDate_sequence_idx over (positionId = '26113ccf-1d6a-4f2e-bef4-d2b2845fa44e' AND effectiveDate < '2026-10-02 16:00:00.000') (reverse), with index condition: ((r.positionId = '26113ccf-1d6a-4f2e-bef4-d2b2845fa44e') and (r.effectiveDate < TIMESTAMP'2026-10-02 16:00:00')) (cost=8960 rows=19910) (actual time=0.00893..0.00893 rows=1 loops=1)\n -> Stream results (cost=8225 rows=1) (actual time=0.0103..0.0103 rows=1 loops=1)\n -> Limit: 1 row(s) (cost=8225 rows=1) (actual time=0.00963..0.00965 rows=1 loops=1)\n -> Index range scan on r using Revision_positionId_effectiveDate_sequence_idx over (positionId = '2965aade-bb10-45bc-a172-f6729f591856' AND effectiveDate < '2026-10-02 16:00:00.000') (reverse), with index condition: ((r.positionId = '2965aade-bb10-45bc-a172-f6729f591856') and (r.effectiveDate < TIMESTAMP'2026-10-02 16:00:00')) (cost=8225 rows=18278) (actual time=0.00951..0.00951 rows=1 loops=1)\n -> Stream results (cost=8732 rows=1) (actual time=0.0104..0.0105 rows=1 loops=1)\n -> Limit: 1 row(s) (cost=8732 rows=1) (actual time=0.00979..0.00981 rows=1 loops=1)\n -> Index range scan on r using Revision_positionId_effectiveDate_sequence_idx over (positionId = 'f757987e-153c-44aa-91db-8abe018468f1' AND effectiveDate < '2026-10-02 16:00:00.000') (reverse), with index condition: ((r.positionId = 'f757987e-153c-44aa-91db-8abe018468f1') and (r.effectiveDate < TIMESTAMP'2026-10-02 16:00:00')) (cost=8732 rows=19404) (actual time=0.00964..0.00964 rows=1 loops=1)\n -> Stream results (cost=8225 rows=1) (actual time=0.00932..0.00939 rows=1 loops=1)\n -> Limit: 1 row(s) (cost=8225 rows=1) (actual time=0.00839..0.00841 rows=1 loops=1)\n -> Index range scan on r using Revision_positionId_effectiveDate_sequence_idx over (positionId = '2a00d18e-5529-4160-afde-ef02be8af760' AND effectiveDate < '2026-10-02 16:00:00.000') (reverse), with index condition: ((r.positionId = '2a00d18e-5529-4160-afde-ef02be8af760') and (r.effectiveDate < TIMESTAMP'2026-10-02 16:00:00')) (cost=8225 rows=18278) (actual time=0.00831..0.00831 rows=1 loops=1)\n -> Stream results (cost=9349 rows=1) (actual time=0.00764..0.0077 rows=1 loops=1)\n -> Limit: 1 row(s) (cost=9349 rows=1) (actual time=0.00697..0.00699 rows=1 loops=1)\n -> Index range scan on r using Revision_positionId_effectiveDate_sequence_idx over (positionId = '74118fd8-00d5-47fe-974c-db6bf2b966eb' AND effectiveDate < '2026-10-02 16:00:00.000') (reverse), with index condition: ((r.positionId = '74118fd8-00d5-47fe-974c-db6bf2b966eb') and (r.effectiveDate < TIMESTAMP'2026-10-02 16:00:00')) (cost=9349 rows=20774) (actual time=0.00672..0.00672 rows=1 loops=1)\n -> Stream results (cost=8377 rows=1) (actual time=0.00917..0.00924 rows=1 loops=1)\n -> Limit: 1 row(s) (cost=8377 rows=1) (actual time=0.008..0.00802 rowsLine truncated
}
],
"pagePlan": [
{
"f0": "-> Append (cost=0..0 rows=51) (actual time=0.729..13 rows=51 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.729..0.729 rows=1 loops=1)\n -> Rows fetched before execution (cost=0..0 rows=1) (actual time=40e-6..170e-6 rows=1 loops=1)\n -> Select #2 (subquery in projection; run only once)\n -> Limit: 1 row(s) (cost=8955 rows=1) (actual time=0.721..0.721 rows=1 loops=1)\n -> Index range scan on x using Revision_positionId_effectiveDate_sequence_idx over (positionId = 'abe0b945-e334-4020-8d28-1d4e03266739' AND effectiveDate < '2026-10-01 16:00:00.000') OR (positionId = 'abe0b945-e334-4020-8d28-1d4e03266739' AND effectiveDate = '2026-10-01 16:00:00.000' AND sequence < 540859) (reverse), with index condition: ((x.positionId = 'abe0b945-e334-4020-8d28-1d4e03266739') and ((x.effectiveDate < TIMESTAMP'2026-10-01 16:00:00') or ((x.effectiveDate = TIMESTAMP'2026-10-01 16:00:00') and (x.sequence < 540859)))) (cost=8955 rows=19899) (actual time=0.72..0.72 rows=1 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.746..0.746 rows=1 loops=1)\n -> Rows fetched before execution (cost=0..0 rows=1) (actual time=50e-6..70e-6 rows=1 loops=1)\n -> Select #4 (subquery in projection; run only once)\n -> Limit: 1 row(s) (cost=8955 rows=1) (actual time=0.74..0.74 rows=1 loops=1)\n -> Index range scan on x using Revision_positionId_effectiveDate_sequence_idx over (positionId = '7a7b7ab6-2d18-4ddc-87d5-b7d673d03616' AND effectiveDate < '2026-10-01 16:00:00.000') OR (positionId = '7a7b7ab6-2d18-4ddc-87d5-b7d673d03616' AND effectiveDate = '2026-10-01 16:00:00.000' AND sequence < 530859) (reverse), with index condition: ((x.positionId = '7a7b7ab6-2d18-4ddc-87d5-b7d673d03616') and ((x.effectiveDate < TIMESTAMP'2026-10-01 16:00:00') or ((x.effectiveDate = TIMESTAMP'2026-10-01 16:00:00') and (x.sequence < 530859)))) (cost=8955 rows=19899) (actual time=0.74..0.74 rows=1 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.747..0.747 rows=1 loops=1)\n -> Rows fetched before execution (cost=0..0 rows=1) (actual time=40e-6..70e-6 rows=1 loops=1)\n -> Select #6 (subquery in projection; run only once)\n -> Limit: 1 row(s) (cost=8221 rows=1) (actual time=0.741..0.741 rows=1 loops=1)\n -> Index range scan on x using Revision_positionId_effectiveDate_sequence_idx over (positionId = '928ec1d9-dfe2-4636-af8c-9ef882778826' AND effectiveDate < '2026-10-01 16:00:00.000') OR (positionId = '928ec1d9-dfe2-4636-af8c-9ef882778826' AND effectiveDate = '2026-10-01 16:00:00.000' AND sequence < 520859) (reverse), with index condition: ((x.positionId = '928ec1d9-dfe2-4636-af8c-9ef882778826') and ((x.effectiveDate < TIMESTAMP'2026-10-01 16:00:00') or ((x.effectiveDate = TIMESTAMP'2026-10-01 16:00:00') and (x.sequence < 520859)))) (cost=8221 rows=18267) (actual time=0.741..0.741 rows=1 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.62..0.62 rows=1 loops=1)\n -> Rows fetched before execution (cost=0..0 rows=1) (actual time=40e-6..60e-6 rows=1 loops=1)\n -> Select #8 (subquery in projection; run only once)\n -> Limit: 1 row(s) (cost=8955 rows=1) (actual time=0.613..0.613 rows=1 loops=1)\n -> Index range scan on x using Revision_positionId_effectiveDate_sequence_idx over (positionId = '26113ccf-1d6a-4f2e-bef4-d2b2845fa44e' AND effectiveDate < '2026-10-01 16:00:00.000') OR (positionId = '26113ccf-1d6a-4f2e-bef4-d2b2845fa44e' AND effectiveDate = '2026-10-01 16:00:00.000' AND sequence < 510859) (reverse), with index condition: ((x.positionId = '26113ccf-1d6a-4f2e-bef4-d2b2845fa44e') and ((x.effectiveDate < TIMESTAMP'2026-10-01 16:00:00') or ((x.effectiveDate = TIMESTAMP'2026-10-01 16:00:00') and (x.sequence < 510859)))) (cost=8955 rows=19899) (actual time=0.613..0.613 rows=1 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.626..0.626 rows=1 loops=1)\n -> Rows fetched before execution (cost=0..0 rows=1) (actual time=40e-6..60e-6 rows=1 loops=1)\n -> Select #10 (subquery in projection; run only once)\n -> Limit: 1 row(s) (cost=8221 rows=1) (actual time=0.621..0.621 rows=1 loops=1)\n -> Index range scan on x using Revision_positionId_effectiveDate_sequence_idx over (positionId = '2965aade-bb10-45bc-a172-f6729f591856' AND effectiveDate < '2026-10-01 16:00:00.000') OR (positionId = '2965aade-bb10-45bc-a172-f6729f591856' AND effectiveDate = '2026-10-01 16:00:00.000' AND sequence < 500859) (reverse), with index condition: ((x.positionId = '2965aade-bb10-45bc-a172-f6729f591856') and ((x.effectiveDate < TIMESTAMP'2026-10-01 16:00:00') or ((x.effectiveDate = TIMESTAMP'2026-10-01 16:00:00') and (x.sequence < 500859)))) (cost=8221 rows=18267) (actual time=0.621..0.621 rows=1 loops=1)\n -> Stream results (cost=0..0 rows=1) (actual time=0.644..0.644 rows=1 loops=1)\n Line truncated
}
],
"candidatePlans": [
[
{
"f0": "-> Limit: 51 row(s) (cost=3100 rows=51) (actual time=0.0512..0.164 rows=51 loops=1)\n -> Index lookup on Revision using Revision_positionId_effectiveDate_sequence_idx (positionId='26113ccf-1d6a-4f2e-bef4-d2b2845fa44e') (reverse) (cost=3100 rows=19920) (actual time=0.0509..0.162 rows=51 loops=1)\n"
}
],
[
{
"f0": "-> Limit: 51 row(s) (cost=2937 rows=51) (actual time=0.00983..0.104 rows=51 loops=1)\n -> Index lookup on Revision using Revision_positionId_effectiveDate_sequence_idx (positionId='2a00d18e-5529-4160-afde-ef02be8af760') (reverse) (cost=2937 rows=18288) (actual time=0.00967..0.102 rows=51 loops=1)\n"
}
],
[
{
"f0": "-> Limit: 51 row(s) (cost=3100 rows=51) (actual time=0.0115..0.111 rows=51 loops=1)\n -> Index lookup on Revision using Revision_positionId_effectiveDate_sequence_idx (positionId='7a7b7ab6-2d18-4ddc-87d5-b7d673d03616') (reverse) (cost=3100 rows=19920) (actual time=0.0113..0.108 rows=51 loops=1)\n"
}
],
[
{
"f0": "-> Limit: 51 row(s) (cost=2937 rows=51) (actual time=0.0128..0.133 rows=51 loops=1)\n -> Index lookup on Revision using Revision_positionId_effectiveDate_sequence_idx (positionId='928ec1d9-dfe2-4636-af8c-9ef882778826') (reverse) (cost=2937 rows=18288) (actual time=0.0126..0.13 rows=51 loops=1)\n"
}
],
[
{
"f0": "-> Limit: 51 row(s) (cost=3299 rows=51) (actual time=0.0112..0.123 rows=51 loops=1)\n -> Index range scan on Revision using Revision_positionId_effectiveDate_sequence_idx over (positionId = 'f757987e-153c-44aa-91db-8abe018468f1') (reverse), with index condition: (revision.positionId = 'f757987e-153c-44aa-91db-8abe018468f1') (cost=3299 rows=19414) (actual time=0.011..0.121 rows=51 loops=1)\n"
}
],
[
{
"f0": "-> Limit: 51 row(s) (cost=3324 rows=51) (actual time=0.0205..0.141 rows=51 loops=1)\n -> Index range scan on Revision using Revision_positionId_effectiveDate_sequence_idx over (positionId = 'abe0b945-e334-4020-8d28-1d4e03266739') (reverse), with index condition: (revision.positionId = 'abe0b945-e334-4020-8d28-1d4e03266739') (cost=3324 rows=19920) (actual time=0.0203..0.138 rows=51 loops=1)\n"
}
],
[
{
"f0": "-> Limit: 51 row(s) (cost=2971 rows=51) (actual time=0.0266..0.191 rows=51 loops=1)\n -> Index lookup on Revision using Revision_positionId_effectiveDate_sequence_idx (positionId='696e54a9-ee0b-45f0-b634-b08c26e4a902') (reverse) (cost=2971 rows=18624) (actual time=0.0261..0.188 rows=51 loops=1)\n"
}
],
[
{
"f0": "-> Limit: 51 row(s) (cost=3418 rows=51) (actual time=0.0229..0.199 rows=51 loops=1)\n -> Index range scan on Revision using Revision_positionId_effectiveDate_sequence_idx over (positionId = '1abba907-af9b-447b-b281-84fc7b08b6d9') (reverse), with index condition: (revision.positionId = '1abba907-af9b-447b-b281-84fc7b08b6d9') (cost=3418 rows=21636) (actual time=0.022..0.196 rows=51 loops=1)\n"
}
],
[
{
"f0": "-> Limit: 51 row(s) (cost=2937 rows=51) (actual time=0.0102..0.0974 rows=51 loops=1)\n -> Index lookup on Revision using Revision_positionId_effectiveDate_sequence_idx (positionId='2965aade-bb10-45bc-a172-f6729f591856') (reverse) (cost=2937 rows=18288) (actual time=0.0101..0.0951 rows=51 loops=1)\n"
}
],
[
{
"f0": "-> Limit: 51 row(s) (cost=3360 rows=51) (actual time=0.0184..0.249 rows=51 loops=1)\n -> Index range scan on Revision using Revision_positionId_effectiveDate_sequence_idx over (positionId = '74118fd8-00d5-47fe-974c-db6bf2b966eb') (reverse), with index condition: (revision.positionId = '74118fd8-00d5-47fe-974c-db6bf2b966eb') (cost=3360 rows=20786) (actual time=0.018..0.246 rows=51 loops=1)\n"
}
]
]
}
]
}