Files

34 lines
1.4 KiB
Plaintext

# explain: EXPLAIN of the history page (full plans: explain-history.txt)
# date: 2026-10-14 20:24:32, commit: 0ab3a34 + uncommitted changes
# command: python.exe student-tests/explain.py
# exit code: 0, 0.7 s
=== Data volume
=== History index
=== 1. First page: limit=50, the app asks for 51 rows to know if there is a next page
Buffers: shared hit=4
-> Index Scan using messages_history on messages (actual time=0.006..0.009 rows=51 loops=1)
Buffers: shared hit=4
Buffers: shared hit=7
Execution Time: 0.020 ms
=== 2. Page after the 10000th message by keyset cursor (this is what the app does)
Buffers: shared hit=4
-> Index Scan using messages_history on messages (actual time=0.006..0.009 rows=51 loops=1)
Buffers: shared hit=4
Execution Time: 0.030 ms
=== 3. The same page with OFFSET 10000 (the app does NOT do this)
Buffers: shared hit=860
Buffers: shared hit=860
-> Seq Scan on messages (actual time=0.007..1.686 rows=15000 loops=1)
Buffers: shared hit=860
Execution Time: 3.511 ms
=== 4. Query 2 without the index (index is dropped only inside this transaction)
Buffers: shared hit=860
Buffers: shared hit=860
-> Seq Scan on messages (actual time=1.115..1.524 rows=5000 loops=1)
Buffers: shared hit=860
Buffers: shared hit=4
Execution Time: 1.882 ms
=== ROLLBACK: test data removed, index is back
PASS: full plans saved to evidence\explain-history.txt