Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/services/__tests__/cte-exclusive-time.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ tests.forEach((planTest: string) => {
expect(
sumExclusiveDuration([plan.content.Plan].concat(plan.ctes)),
).toBeLessThan(max)

// Expect the exclusive time for the root node not to be negative
expect(plan.content.Plan[NodeProp.EXCLUSIVE_DURATION]).toBeGreaterThan(0)
})
})
})
24 changes: 12 additions & 12 deletions src/services/__tests__/cte-exclusive-time/04.plan
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Limit (cost=3474.45..3474.45 rows=1 width=6) (actual time=0.078..0.080 rows=0 loops=1)
InitPlan 1 (returns $0)
-> Limit (cost=0.56..2.58 rows=1 width=4) (actual time=0.060..0.060 rows=0 loops=1)
-> Index Scan using pond_item_common_pkey on pond_item_common pond_item_common_1 (cost=0.56..2.58 rows=1 width=4) (actual time=0.060..0.060 rows=0 loops=1)
Index Cond: (objectid = 333)
-> Sort (cost=3471.87..3471.87 rows=1 width=6) (actual time=0.078..0.078 rows=0 loops=1)
Sort Key: pond_item_common.nbr_sale, pond_item_common.objectid
Sort Method: quicksort Memory: 25kB
-> Index Scan using pond_item_common_x1 on pond_item_common (cost=0.56..3471.86 rows=1 width=6) (actual time=0.063..0.063 rows=0 loops=1)
Index Cond: (pond_user = $0)
Filter: ((objectid <> 111) AND (status = 30) AND (1 = (misc_bits & 16)) AND (video_standard = ANY ('{1,2,3,4,5,6,7,8,9}'::integer[])))
Total runtime: 0.109 ms
Limit (cost=3474.45..3474.45 rows=1 width=6) (actual time=0.078..0.080 rows=0 loops=1)
InitPlan 1 (returns $0)
-> Limit (cost=0.56..2.58 rows=1 width=4) (actual time=0.060..0.060 rows=0 loops=1)
-> Index Scan using pond_item_common_pkey on pond_item_common pond_item_common_1 (cost=0.56..2.58 rows=1 width=4) (actual time=0.060..0.060 rows=0 loops=1)
Index Cond: (objectid = 333)
-> Sort (cost=3471.87..3471.87 rows=1 width=6) (actual time=0.078..0.078 rows=0 loops=1)
Sort Key: pond_item_common.nbr_sale, pond_item_common.objectid
Sort Method: quicksort Memory: 25kB
-> Index Scan using pond_item_common_x1 on pond_item_common (cost=0.56..3471.86 rows=1 width=6) (actual time=0.063..0.063 rows=0 loops=1)
Index Cond: (pond_user = $0)
Filter: ((objectid <> 111) AND (status = 30) AND (1 = (misc_bits & 16)) AND (video_standard = ANY ('{1,2,3,4,5,6,7,8,9}'::integer[])))
Total runtime: 0.109 ms

30 changes: 15 additions & 15 deletions src/services/__tests__/cte-exclusive-time/05.plan
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Aggregate (cost=259470.50..259470.51 rows=1 width=8) (actual time=1938.292..1938.292 rows=1 loops=1)
InitPlan 2 (returns $1)
-> Result (cost=259419.20..259419.21 rows=1 width=32) (actual time=1736.419..1736.419 rows=1 loops=1)
InitPlan 1 (returns $0)
-> Bitmap Heap Scan on user_data_read_access udr (cost=2990.72..259419.20 rows=116503 width=4) (actual time=86.519..1727.318 rows=124468 loops=1)
Recheck Cond: ((user_id = 1478) AND (entity_type_id = 3))
Rows Removed by Index Recheck: 14687029
Heap Blocks: exact=38322 lossy=79844
-> Bitmap Index Scan on user_data_read_access_uk1 (cost=0.00..2961.60 rows=116503 width=0) (actual time=71.005..71.005 rows=124468 loops=1)
Index Cond: ((user_id = 1478) AND (entity_type_id = 3))
-> Index Scan using pk_vendor on vendor v (cost=0.42..51.27 rows=10 width=4) (actual time=1759.869..1931.146 rows=124468 loops=1)
Index Cond: (id = ANY ($1))
Filter: ((NOT deleted) AND (client_id = 1007))
Planning time: 1.555 ms
Execution time: 1938.457 ms
Aggregate (cost=259470.50..259470.51 rows=1 width=8) (actual time=1938.292..1938.292 rows=1 loops=1)
InitPlan 2 (returns $1)
-> Result (cost=259419.20..259419.21 rows=1 width=32) (actual time=1736.419..1736.419 rows=1 loops=1)
InitPlan 1 (returns $0)
-> Bitmap Heap Scan on user_data_read_access udr (cost=2990.72..259419.20 rows=116503 width=4) (actual time=86.519..1727.318 rows=124468 loops=1)
Recheck Cond: ((user_id = 1478) AND (entity_type_id = 3))
Rows Removed by Index Recheck: 14687029
Heap Blocks: exact=38322 lossy=79844
-> Bitmap Index Scan on user_data_read_access_uk1 (cost=0.00..2961.60 rows=116503 width=0) (actual time=71.005..71.005 rows=124468 loops=1)
Index Cond: ((user_id = 1478) AND (entity_type_id = 3))
-> Index Scan using pk_vendor on vendor v (cost=0.42..51.27 rows=10 width=4) (actual time=1759.869..1931.146 rows=124468 loops=1)
Index Cond: (id = ANY ($1))
Filter: ((NOT deleted) AND (client_id = 1007))
Planning time: 1.555 ms
Execution time: 1938.457 ms

Loading