25 lines
1.6 KiB
Plaintext
Executable File
25 lines
1.6 KiB
Plaintext
Executable File
-- Crown Task 4 — unified feed query (precompute parent path): visibility + keyset + Top-N in ONE plan
|
|
-- FeedCrownIT.crownUnifiedPlanStacksVisibilityKeysetAndTopN (seed 2000, viewer user008, page 1)
|
|
-- 읽기 포인트: 세 기법이 한 플랜에 재정렬(Sort) 없이 겹쳐 있다 —
|
|
-- (1) 가시성+keyset = feed_visible 커버링 인덱스의 Index Only Scan (viewer_id 조건, Heap Fetches 20),
|
|
-- (2) Top-N = 부모 20건당 ix_highlights_feed_items_created 로 top-3 index seek (Nested Loop = LATERAL),
|
|
-- (3) Sort 노드 없음 — 두 순서(부모 keyset·자식 created_at)가 모두 인덱스에서 나온다.
|
|
|
|
Nested Loop (cost=0.56..271.10 rows=60 width=686) (actual time=0.036..0.092 rows=60 loops=1)
|
|
Buffers: shared hit=65 read=2
|
|
-> Limit (cost=0.28..1.84 rows=20 width=24) (actual time=0.025..0.028 rows=20 loops=1)
|
|
Buffers: shared hit=1 read=2
|
|
-> Index Only Scan using ix_feed_visible on feed_visible (cost=0.28..117.22 rows=1500 width=24) (actual time=0.025..0.027 rows=20 loops=1)
|
|
Index Cond: (viewer_id = '9ed28556-7ab3-4f5a-b327-7e0dd9536bf8'::uuid)
|
|
Heap Fetches: 20
|
|
Buffers: shared hit=1 read=2
|
|
-> Limit (cost=0.28..13.42 rows=3 width=670) (actual time=0.003..0.003 rows=3 loops=20)
|
|
Buffers: shared hit=64
|
|
-> Index Scan using ix_highlights_feed_items_created on highlights h (cost=0.28..48.47 rows=11 width=670) (actual time=0.002..0.003 rows=3 loops=20)
|
|
Index Cond: (feed_item_id = feed_visible.feed_item_id)
|
|
Buffers: shared hit=64
|
|
Planning:
|
|
Buffers: shared hit=11 read=1
|
|
Planning Time: 0.122 ms
|
|
Execution Time: 0.120 ms
|