| 372 | | |QUERY PLAN | |
| 373 | | |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 374 | | |Sort (cost=95.36..95.54 rows=70 width=1144) (actual time=0.465..0.469 rows=4 loops=1) | |
| 375 | | | Sort Key: with_growth.quarter DESC, (rank() OVER (?)) | |
| 376 | | | Sort Method: quicksort Memory: 25kB | |
| 377 | | | -> WindowAgg (cost=91.64..93.22 rows=70 width=1144) (actual time=0.449..0.460 rows=4 loops=1) | |
| 378 | | | -> Sort (cost=91.64..91.82 rows=70 width=1104) (actual time=0.438..0.442 rows=4 loops=1) | |
| 379 | | | Sort Key: with_growth.quarter, with_growth.total_views DESC | |
| 380 | | | Sort Method: quicksort Memory: 25kB | |
| 381 | | | -> Subquery Scan on with_growth (cost=84.77..89.50 rows=70 width=1104) (actual time=0.420..0.435 rows=4 loops=1) | |
| 382 | | | -> WindowAgg (cost=84.77..88.80 rows=70 width=1132) (actual time=0.419..0.432 rows=4 loops=1) | |
| 383 | | | -> Sort (cost=84.77..84.95 rows=70 width=1044) (actual time=0.411..0.414 rows=4 loops=1) | |
| 384 | | | Sort Key: u.user_id, (date_trunc('quarter'::text, s.story_created_at)) | |
| 385 | | | Sort Method: quicksort Memory: 25kB | |
| 386 | | | -> GroupAggregate (cost=79.65..82.63 rows=70 width=1044) (actual time=0.349..0.407 rows=4 loops=1) | |
| 387 | | | Group Key: (date_trunc('quarter'::text, s.story_created_at)), u.user_id | |
| 388 | | | -> Sort (cost=79.65..79.83 rows=70 width=995) (actual time=0.291..0.300 rows=118 loops=1) | |
| 389 | | | Sort Key: (date_trunc('quarter'::text, s.story_created_at)), u.user_id, s.story_id | |
| 390 | | | Sort Method: quicksort Memory: 35kB | |
| 391 | | | -> Merge Left Join (cost=0.98..77.51 rows=70 width=995) (actual time=0.082..0.231 rows=118 loops=1) | |
| 392 | | | Merge Cond: (s.story_id = l.story_id) | |
| 393 | | | -> Merge Left Join (cost=0.84..63.80 rows=20 width=991) (actual time=0.066..0.141 rows=26 loops=1) | |
| 394 | | | Merge Cond: (s.story_id = ch.story_id) | |
| 395 | | | -> Nested Loop Left Join (cost=0.71..50.17 rows=9 width=972) (actual time=0.052..0.088 rows=10 loops=1) | |
| 396 | | | -> Nested Loop (cost=0.57..39.81 rows=4 width=968) (actual time=0.043..0.069 rows=4 loops=1) | |
| 397 | | | Join Filter: (s.user_id = u.user_id) | |
| 398 | | | -> Nested Loop (cost=0.43..39.06 rows=4 width=20) (actual time=0.035..0.054 rows=4 loops=1) | |
| 399 | | | -> Nested Loop (cost=0.27..22.80 rows=4 width=16) (actual time=0.020..0.030 rows=4 loops=1) | |
| 400 | | | -> Index Only Scan using status_pk on status st (cost=0.13..12.21 rows=4 width=4) (actual time=0.010..0.012 rows=4 loops=1)| |
| 401 | | | Index Cond: (status = 'published'::text) | |
| 402 | | | Heap Fetches: 4 | |
| 403 | | | -> Index Scan using story_pkey on story s (cost=0.13..3.15 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=4) | |
| 404 | | | Index Cond: (story_id = st.story_id) | |
| 405 | | | -> Memoize (cost=0.17..4.98 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=4) | |
| 406 | | | Cache Key: s.user_id | |
| 407 | | | Cache Mode: logical | |
| 408 | | | Hits: 1 Misses: 3 Evictions: 0 Overflows: 0 Memory Usage: 1kB | |
| 409 | | | -> Index Only Scan using writer_pkey on writer w (cost=0.15..4.97 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=3)| |
| 410 | | | Index Cond: (user_id = s.user_id) | |
| 411 | | | Heap Fetches: 3 | |
| 412 | | | -> Index Scan using users_pkey on users u (cost=0.14..0.18 rows=1 width=956) (actual time=0.003..0.003 rows=1 loops=4) | |
| 413 | | | Index Cond: (user_id = w.user_id) | |
| 414 | | | -> Index Scan using idx_comment_story_id on comment c (cost=0.14..2.57 rows=2 width=8) (actual time=0.003..0.004 rows=2 loops=4) | |
| 415 | | | Index Cond: (story_id = s.story_id) | |
| 416 | | | -> Materialize (cost=0.14..13.33 rows=11 width=23) (actual time=0.010..0.038 rows=27 loops=1) | |
| 417 | | | -> Index Scan using idx_chapter_story_id on chapter ch (cost=0.14..13.30 rows=11 width=23) (actual time=0.007..0.029 rows=11 loops=1) | |
| 418 | | | -> Materialize (cost=0.14..12.45 rows=18 width=8) (actual time=0.008..0.021 rows=119 loops=1) | |
| 419 | | | -> Index Scan using idx_likes_story_id on likes l (cost=0.14..12.41 rows=18 width=8) (actual time=0.007..0.012 rows=18 loops=1) | |
| 420 | | |Planning Time: 2.783 ms | |
| 421 | | |Execution Time: 0.636 ms |
| 422 | | }}} |
| | 372 | |QUERY PLAN | |
| | 373 | |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| | 374 | |Sort (cost=688.46..689.71 rows=500 width=221) (actual time=9.579..9.586 rows=19 loops=1) | |
| | 375 | | Sort Key: with_growth.quarter DESC, (rank() OVER (?)) | |
| | 376 | | Sort Method: quicksort Memory: 27kB | |
| | 377 | | -> WindowAgg (cost=654.82..666.05 rows=500 width=221) (actual time=9.529..9.560 rows=19 loops=1) | |
| | 378 | | -> Sort (cost=654.80..656.05 rows=500 width=181) (actual time=9.518..9.524 rows=19 loops=1) | |
| | 379 | | Sort Key: with_growth.quarter, with_growth.total_views DESC | |
| | 380 | | Sort Method: quicksort Memory: 27kB | |
| | 381 | | -> Subquery Scan on with_growth (cost=598.66..632.38 rows=500 width=181) (actual time=9.459..9.508 rows=19 loops=1) | |
| | 382 | | -> WindowAgg (cost=598.66..627.38 rows=500 width=209) (actual time=9.457..9.503 rows=19 loops=1) | |
| | 383 | | -> Sort (cost=598.63..599.88 rows=500 width=121) (actual time=9.448..9.454 rows=19 loops=1) | |
| | 384 | | Sort Key: u.user_id, (date_trunc('quarter'::text, s.story_created_at)) | |
| | 385 | | Sort Method: quicksort Memory: 27kB | |
| | 386 | | -> GroupAggregate (cost=440.37..576.22 rows=500 width=121) (actual time=6.339..9.436 rows=19 loops=1) | |
| | 387 | | Group Key: (date_trunc('quarter'::text, s.story_created_at)), u.user_id | |
| | 388 | | -> Sort (cost=440.37..453.08 rows=5084 width=72) (actual time=6.235..6.563 rows=5518 loops=1) | |
| | 389 | | Sort Key: (date_trunc('quarter'::text, s.story_created_at)), u.user_id, s.story_id | |
| | 390 | | Sort Method: quicksort Memory: 701kB | |
| | 391 | | -> Hash Left Join (cost=35.11..127.40 rows=5084 width=72) (actual time=0.461..3.099 rows=5518 loops=1) | |
| | 392 | | Hash Cond: (s.story_id = l.story_id) | |
| | 393 | | -> Hash Right Join (cost=26.63..46.59 rows=882 width=68) (actual time=0.349..0.628 rows=926 loops=1) | |
| | 394 | | Hash Cond: (ch.story_id = s.story_id) | |
| | 395 | | -> Seq Scan on chapter ch (cost=0.00..9.36 rows=236 width=23) (actual time=0.008..0.048 rows=236 loops=1) | |
| | 396 | | -> Hash (cost=24.30..24.30 rows=187 width=49) (actual time=0.332..0.336 rows=190 loops=1) | |
| | 397 | | Buckets: 1024 Batches: 1 Memory Usage: 24kB | |
| | 398 | | -> Hash Right Join (cost=16.80..24.30 rows=187 width=49) (actual time=0.194..0.282 rows=190 loops=1) | |
| | 399 | | Hash Cond: (c.story_id = s.story_id) | |
| | 400 | | -> Seq Scan on comment c (cost=0.00..4.91 rows=191 width=8) (actual time=0.011..0.032 rows=191 loops=1) | |
| | 401 | | -> Hash (cost=16.19..16.19 rows=49 width=45) (actual time=0.176..0.179 rows=49 loops=1) | |
| | 402 | | Buckets: 1024 Batches: 1 Memory Usage: 12kB | |
| | 403 | | -> Hash Join (cost=3.63..16.19 rows=49 width=45) (actual time=0.089..0.165 rows=49 loops=1) | |
| | 404 | | Hash Cond: (s.user_id = u.user_id) | |
| | 405 | | -> Nested Loop (cost=2.40..14.78 rows=49 width=20) (actual time=0.057..0.118 rows=49 loops=1) | |
| | 406 | | -> Hash Join (cost=2.24..6.88 rows=49 width=16) (actual time=0.039..0.070 rows=49 loops=1) | |
| | 407 | | Hash Cond: (s.story_id = st.story_id) | |
| | 408 | | -> Seq Scan on story s (cost=0.00..4.50 rows=50 width=16) (actual time=0.007..0.017 rows=50 loops=1) | |
| | 409 | | -> Hash (cost=1.62..1.62 rows=49 width=4) (actual time=0.024..0.025 rows=49 loops=1) | |
| | 410 | | Buckets: 1024 Batches: 1 Memory Usage: 10kB | |
| | 411 | | -> Seq Scan on status st (cost=0.00..1.62 rows=49 width=4) (actual time=0.008..0.017 rows=49 loops=1) | |
| | 412 | | Filter: ((status)::text = 'published'::text) | |
| | 413 | | Rows Removed by Filter: 1 | |
| | 414 | | -> Memoize (cost=0.17..1.14 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=49) | |
| | 415 | | Cache Key: s.user_id | |
| | 416 | | Cache Mode: logical | |
| | 417 | | Hits: 44 Misses: 5 Evictions: 0 Overflows: 0 Memory Usage: 1kB | |
| | 418 | | -> Index Only Scan using writer_pkey on writer w (cost=0.15..1.13 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=5)| |
| | 419 | | Index Cond: (user_id = s.user_id) | |
| | 420 | | Heap Fetches: 5 | |
| | 421 | | -> Hash (cost=1.10..1.10 rows=10 width=33) (actual time=0.025..0.026 rows=10 loops=1) | |
| | 422 | | Buckets: 1024 Batches: 1 Memory Usage: 9kB | |
| | 423 | | -> Seq Scan on users u (cost=0.00..1.10 rows=10 width=33) (actual time=0.016..0.019 rows=10 loops=1) | |
| | 424 | | -> Hash (cost=4.88..4.88 rows=288 width=8) (actual time=0.099..0.099 rows=288 loops=1) | |
| | 425 | | Buckets: 1024 Batches: 1 Memory Usage: 20kB | |
| | 426 | | -> Seq Scan on likes l (cost=0.00..4.88 rows=288 width=8) (actual time=0.014..0.052 rows=288 loops=1) | |
| | 427 | |Planning Time: 3.502 ms | |
| | 428 | |Execution Time: 9.792 ms | |
| | 429 | }}} |
| | 430 | Average time: 9.913 ms |
| 436 | | |QUERY PLAN | |
| 437 | | |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 438 | | |Sort (cost=95.34..95.52 rows=70 width=1144) (actual time=0.464..0.468 rows=4 loops=1) | |
| 439 | | | Sort Key: with_growth.quarter DESC, (rank() OVER (?)) | |
| 440 | | | Sort Method: quicksort Memory: 25kB | |
| 441 | | | -> WindowAgg (cost=91.62..93.20 rows=70 width=1144) (actual time=0.447..0.458 rows=4 loops=1) | |
| 442 | | | -> Sort (cost=91.62..91.80 rows=70 width=1104) (actual time=0.436..0.440 rows=4 loops=1) | |
| 443 | | | Sort Key: with_growth.quarter, with_growth.total_views DESC | |
| 444 | | | Sort Method: quicksort Memory: 25kB | |
| 445 | | | -> Subquery Scan on with_growth (cost=84.75..89.48 rows=70 width=1104) (actual time=0.418..0.434 rows=4 loops=1) | |
| 446 | | | -> WindowAgg (cost=84.75..88.78 rows=70 width=1132) (actual time=0.417..0.431 rows=4 loops=1) | |
| 447 | | | -> Sort (cost=84.75..84.93 rows=70 width=1044) (actual time=0.409..0.412 rows=4 loops=1) | |
| 448 | | | Sort Key: u.user_id, (date_trunc('quarter'::text, s.story_created_at)) | |
| 449 | | | Sort Method: quicksort Memory: 25kB | |
| 450 | | | -> GroupAggregate (cost=79.63..82.61 rows=70 width=1044) (actual time=0.348..0.406 rows=4 loops=1) | |
| 451 | | | Group Key: (date_trunc('quarter'::text, s.story_created_at)), u.user_id | |
| 452 | | | -> Sort (cost=79.63..79.81 rows=70 width=995) (actual time=0.290..0.299 rows=118 loops=1) | |
| 453 | | | Sort Key: (date_trunc('quarter'::text, s.story_created_at)), u.user_id, s.story_id | |
| 454 | | | Sort Method: quicksort Memory: 35kB | |
| 455 | | | -> Merge Left Join (cost=0.98..77.49 rows=70 width=995) (actual time=0.100..0.233 rows=118 loops=1) | |
| 456 | | | Merge Cond: (s.story_id = l.story_id) | |
| 457 | | | -> Merge Left Join (cost=0.84..63.78 rows=20 width=991) (actual time=0.084..0.145 rows=26 loops=1) | |
| 458 | | | Merge Cond: (s.story_id = ch.story_id) | |
| 459 | | | -> Nested Loop Left Join (cost=0.70..50.15 rows=9 width=972) (actual time=0.070..0.108 rows=10 loops=1) | |
| 460 | | | -> Nested Loop (cost=0.57..39.79 rows=4 width=968) (actual time=0.060..0.087 rows=4 loops=1) | |
| 461 | | | Join Filter: (s.user_id = u.user_id) | |
| 462 | | | -> Nested Loop (cost=0.43..39.04 rows=4 width=20) (actual time=0.052..0.071 rows=4 loops=1) | |
| 463 | | | -> Nested Loop (cost=0.26..22.78 rows=4 width=16) (actual time=0.019..0.029 rows=4 loops=1) | |
| 464 | | | -> Index Only Scan using idx_status_published on status st (cost=0.13..12.19 rows=4 width=4) (actual time=0.009..0.011 rows=4 loops=1)| |
| 465 | | | Heap Fetches: 4 | |
| 466 | | | -> Index Scan using story_pkey on story s (cost=0.13..3.15 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=4) | |
| 467 | | | Index Cond: (story_id = st.story_id) | |
| 468 | | | -> Memoize (cost=0.17..4.98 rows=1 width=4) (actual time=0.009..0.009 rows=1 loops=4) | |
| 469 | | | Cache Key: s.user_id | |
| 470 | | | Cache Mode: logical | |
| 471 | | | Hits: 1 Misses: 3 Evictions: 0 Overflows: 0 Memory Usage: 1kB | |
| 472 | | | -> Index Only Scan using writer_pkey on writer w (cost=0.15..4.97 rows=1 width=4) (actual time=0.010..0.010 rows=1 loops=3) | |
| 473 | | | Index Cond: (user_id = s.user_id) | |
| 474 | | | Heap Fetches: 3 | |
| 475 | | | -> Index Scan using users_pkey on users u (cost=0.14..0.18 rows=1 width=956) (actual time=0.003..0.003 rows=1 loops=4) | |
| 476 | | | Index Cond: (user_id = w.user_id) | |
| 477 | | | -> Index Scan using idx_comment_story_id on comment c (cost=0.14..2.57 rows=2 width=8) (actual time=0.003..0.004 rows=2 loops=4) | |
| 478 | | | Index Cond: (story_id = s.story_id) | |
| 479 | | | -> Materialize (cost=0.14..13.33 rows=11 width=23) (actual time=0.010..0.022 rows=27 loops=1) | |
| 480 | | | -> Index Scan using idx_chapter_story_id on chapter ch (cost=0.14..13.30 rows=11 width=23) (actual time=0.007..0.012 rows=11 loops=1) | |
| 481 | | | -> Materialize (cost=0.14..12.45 rows=18 width=8) (actual time=0.008..0.021 rows=119 loops=1) | |
| 482 | | | -> Index Scan using idx_likes_story_id on likes l (cost=0.14..12.41 rows=18 width=8) (actual time=0.007..0.011 rows=18 loops=1) | |
| 483 | | |Planning Time: 2.858 ms | |
| 484 | | |Execution Time: 0.631 ms | |
| 485 | | }}} |
| 486 | | Average time: 0.628 ms |
| 487 | | The indexes added for this query provided no meaningful improvement, with average execution time remaining virtually unchanged from 0.649 ms to 0.628 ms (~3%), which is within normal measurement variance. The indexes are not kept. |
| | 447 | |QUERY PLAN | |
| | 448 | |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| | 449 | |Sort (cost=688.46..689.71 rows=500 width=221) (actual time=9.541..9.548 rows=19 loops=1) | |
| | 450 | | Sort Key: with_growth.quarter DESC, (rank() OVER (?)) | |
| | 451 | | Sort Method: quicksort Memory: 27kB | |
| | 452 | | -> WindowAgg (cost=654.82..666.05 rows=500 width=221) (actual time=9.491..9.522 rows=19 loops=1) | |
| | 453 | | -> Sort (cost=654.80..656.05 rows=500 width=181) (actual time=9.481..9.487 rows=19 loops=1) | |
| | 454 | | Sort Key: with_growth.quarter, with_growth.total_views DESC | |
| | 455 | | Sort Method: quicksort Memory: 27kB | |
| | 456 | | -> Subquery Scan on with_growth (cost=598.66..632.38 rows=500 width=181) (actual time=9.423..9.472 rows=19 loops=1) | |
| | 457 | | -> WindowAgg (cost=598.66..627.38 rows=500 width=209) (actual time=9.421..9.467 rows=19 loops=1) | |
| | 458 | | -> Sort (cost=598.63..599.88 rows=500 width=121) (actual time=9.413..9.419 rows=19 loops=1) | |
| | 459 | | Sort Key: u.user_id, (date_trunc('quarter'::text, s.story_created_at)) | |
| | 460 | | Sort Method: quicksort Memory: 27kB | |
| | 461 | | -> GroupAggregate (cost=440.37..576.22 rows=500 width=121) (actual time=6.315..9.403 rows=19 loops=1) | |
| | 462 | | Group Key: (date_trunc('quarter'::text, s.story_created_at)), u.user_id | |
| | 463 | | -> Sort (cost=440.37..453.08 rows=5084 width=72) (actual time=6.220..6.549 rows=5518 loops=1) | |
| | 464 | | Sort Key: (date_trunc('quarter'::text, s.story_created_at)), u.user_id, s.story_id | |
| | 465 | | Sort Method: quicksort Memory: 701kB | |
| | 466 | | -> Hash Left Join (cost=35.11..127.40 rows=5084 width=72) (actual time=0.458..3.066 rows=5518 loops=1) | |
| | 467 | | Hash Cond: (s.story_id = l.story_id) | |
| | 468 | | -> Hash Right Join (cost=26.63..46.59 rows=882 width=68) (actual time=0.346..0.619 rows=926 loops=1) | |
| | 469 | | Hash Cond: (ch.story_id = s.story_id) | |
| | 470 | | -> Seq Scan on chapter ch (cost=0.00..9.36 rows=236 width=23) (actual time=0.008..0.048 rows=236 loops=1) | |
| | 471 | | -> Hash (cost=24.30..24.30 rows=187 width=49) (actual time=0.331..0.335 rows=190 loops=1) | |
| | 472 | | Buckets: 1024 Batches: 1 Memory Usage: 24kB | |
| | 473 | | -> Hash Right Join (cost=16.80..24.30 rows=187 width=49) (actual time=0.194..0.283 rows=190 loops=1) | |
| | 474 | | Hash Cond: (c.story_id = s.story_id) | |
| | 475 | | -> Seq Scan on comment c (cost=0.00..4.91 rows=191 width=8) (actual time=0.011..0.032 rows=191 loops=1) | |
| | 476 | | -> Hash (cost=16.19..16.19 rows=49 width=45) (actual time=0.176..0.179 rows=49 loops=1) | |
| | 477 | | Buckets: 1024 Batches: 1 Memory Usage: 12kB | |
| | 478 | | -> Hash Join (cost=3.63..16.19 rows=49 width=45) (actual time=0.090..0.165 rows=49 loops=1) | |
| | 479 | | Hash Cond: (s.user_id = u.user_id) | |
| | 480 | | -> Nested Loop (cost=2.40..14.78 rows=49 width=20) (actual time=0.059..0.119 rows=49 loops=1) | |
| | 481 | | -> Hash Join (cost=2.24..6.88 rows=49 width=16) (actual time=0.040..0.071 rows=49 loops=1) | |
| | 482 | | Hash Cond: (s.story_id = st.story_id) | |
| | 483 | | -> Seq Scan on story s (cost=0.00..4.50 rows=50 width=16) (actual time=0.006..0.017 rows=50 loops=1) | |
| | 484 | | -> Hash (cost=1.62..1.62 rows=49 width=4) (actual time=0.024..0.025 rows=49 loops=1) | |
| | 485 | | Buckets: 1024 Batches: 1 Memory Usage: 10kB | |
| | 486 | | -> Seq Scan on status st (cost=0.00..1.62 rows=49 width=4) (actual time=0.008..0.016 rows=49 loops=1) | |
| | 487 | | Filter: ((status)::text = 'published'::text) | |
| | 488 | | Rows Removed by Filter: 1 | |
| | 489 | | -> Memoize (cost=0.17..1.14 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=49) | |
| | 490 | | Cache Key: s.user_id | |
| | 491 | | Cache Mode: logical | |
| | 492 | | Hits: 44 Misses: 5 Evictions: 0 Overflows: 0 Memory Usage: 1kB | |
| | 493 | | -> Index Only Scan using writer_pkey on writer w (cost=0.15..1.13 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=5)| |
| | 494 | | Index Cond: (user_id = s.user_id) | |
| | 495 | | Heap Fetches: 5 | |
| | 496 | | -> Hash (cost=1.10..1.10 rows=10 width=33) (actual time=0.024..0.024 rows=10 loops=1) | |
| | 497 | | Buckets: 1024 Batches: 1 Memory Usage: 9kB | |
| | 498 | | -> Seq Scan on users u (cost=0.00..1.10 rows=10 width=33) (actual time=0.014..0.017 rows=10 loops=1) | |
| | 499 | | -> Hash (cost=4.88..4.88 rows=288 width=8) (actual time=0.099..0.099 rows=288 loops=1) | |
| | 500 | | Buckets: 1024 Batches: 1 Memory Usage: 20kB | |
| | 501 | | -> Seq Scan on likes l (cost=0.00..4.88 rows=288 width=8) (actual time=0.014..0.052 rows=288 loops=1) | |
| | 502 | |Planning Time: 3.608 ms | |
| | 503 | |Execution Time: 9.728 ms | |
| | 504 | }}} |
| | 505 | Average time: 9.830 ms |
| | 506 | Three indexes were created for Scenario 2: idx_status_story_published, idx_has_genre_genre_id, and idx_users_writer_covering. The planner naturally uses writer_pkey as an Index Only Scan; remaining tables use Hash Joins with Seq Scans as they fit in memory at this data volume. Average execution time: 9.913 ms without indexes vs 9.830 ms with indexes. The indexes are kept and will be utilized as data volume grows. |