16b_js.txt

text/plain

Filename: 16b_js.txt
Type: text/plain
Part: 4
Message: Re: Is there value in having optimizer stats for joins/foreignkeys?
Pager usage is off.
SET
                                                                                                QUERY PLAN                                                                                                
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Finalize Aggregate  (cost=280264.91..280264.92 rows=1 width=64) (actual time=2741.164..2763.554 rows=1.00 loops=1)
   Buffers: shared hit=4178268 read=1093110, temp read=22572 written=22652
   ->  Gather  (cost=280264.69..280264.90 rows=2 width=64) (actual time=2738.152..2763.550 rows=3.00 loops=1)
         Workers Planned: 2
         Workers Launched: 2
         Buffers: shared hit=4178268 read=1093110, temp read=22572 written=22652
         ->  Partial Aggregate  (cost=279264.69..279264.70 rows=1 width=64) (actual time=2736.217..2736.250 rows=1.00 loops=3)
               Buffers: shared hit=4178268 read=1093110, temp read=22572 written=22652
               ->  Parallel Hash Join  (cost=136368.90..271857.81 rows=1481375 width=33) (actual time=2244.259..2397.555 rows=1236864.00 loops=3)
                     Hash Cond: (n.id = an.person_id)
                     Buffers: shared hit=4178268 read=1093110, temp read=22572 written=22652
                     ->  Nested Loop  (cost=114301.82..235944.12 rows=635491 width=25) (actual time=198.873..2044.905 rows=944185.00 loops=3)
                           Buffers: shared hit=4177986 read=1081976, temp read=1698 written=1704
                           ->  Nested Loop  (cost=114301.38..188137.25 rows=635491 width=21) (actual time=198.784..1236.382 rows=944185.00 loops=3)
                                 Join Filter: (ci.movie_id = t.id)
                                 Buffers: shared hit=2546486 read=732334, temp read=1698 written=1704
                                 ->  Nested Loop  (cost=114300.94..131790.25 rows=30693 width=29) (actual time=198.716..273.204 rows=22772.00 loops=3)
                                       Buffers: shared hit=268202 read=61791, temp read=1698 written=1704
                                       ->  Merge Join  (cost=114300.51..116833.42 rows=30693 width=8) (actual time=198.599..222.967 rows=22772.00 loops=3)
                                             Merge Cond: (mc.movie_id = mk.movie_id)
                                             Buffers: shared hit=23792 read=32935, temp read=1698 written=1704
                                             ->  Sort  (cost=81821.71..82837.92 rows=406485 width=4) (actual time=126.514..138.221 rows=384599.00 loops=3)
                                                   Sort Key: mc.movie_id
                                                   Sort Method: external merge  Disk: 4584kB
                                                   Buffers: shared hit=8 read=21864, temp read=1698 written=1704
                                                   Worker 0:  Sort Method: external merge  Disk: 4536kB
                                                   Worker 1:  Sort Method: external merge  Disk: 4464kB
                                                   ->  Parallel Hash Join  (cost=5393.42..38393.85 rows=406485 width=4) (actual time=10.192..94.773 rows=384599.00 loops=3)
                                                         Hash Cond: (mc.company_id = cn.id)
                                                         Buffers: shared read=21864
                                                         ->  Parallel Seq Scan on movie_companies mc  (cost=0.00..30052.81 rows=1122881 width=8) (actual time=0.108..28.237 rows=869709.33 loops=3)
                                                               Buffers: shared read=18824
                                                         ->  Parallel Hash  (cost=4767.91..4767.91 rows=50041 width=4) (actual time=10.007..10.007 rows=28281.00 loops=3)
                                                               Buckets: 131072  Batches: 1  Memory Usage: 4416kB
                                                               Buffers: shared read=3040
                                                               ->  Parallel Seq Scan on company_name cn  (cost=0.00..4767.91 rows=50041 width=4) (actual time=0.104..8.026 rows=28281.00 loops=3)
                                                                     Filter: ((country_code)::text = '[us]'::text)
                                                                     Rows Removed by Filter: 50051
                                                                     Buffers: shared read=3040
                                             ->  Sort  (cost=32478.65..32575.53 rows=38749 width=4) (actual time=72.067..73.364 rows=52744.00 loops=3)
                                                   Sort Key: mk.movie_id
                                                   Sort Method: quicksort  Memory: 1537kB
                                                   Buffers: shared hit=23784 read=11071
                                                   Worker 0:  Sort Method: quicksort  Memory: 1537kB
                                                   Worker 1:  Sort Method: quicksort  Memory: 1537kB
                                                   ->  Nested Loop  (cost=444.74..29525.62 rows=38749 width=4) (actual time=2.513..69.487 rows=41840.00 loops=3)
                                                         Buffers: shared hit=23784 read=11071
                                                         ->  Seq Scan on keyword k  (cost=0.00..2685.11 rows=1 width=4) (actual time=0.302..3.581 rows=1.00 loops=3)
                                                               Filter: (keyword = 'character-name-in-title'::text)
                                                               Rows Removed by Filter: 134168
                                                               Buffers: shared hit=2987 read=37
                                                         ->  Bitmap Heap Scan on movie_keyword mk  (cost=444.74..26453.01 rows=38749 width=8) (actual time=2.209..63.804 rows=41840.00 loops=3)
                                                               Recheck Cond: (k.id = keyword_id)
                                                               Heap Blocks: exact=11547
                                                               Buffers: shared hit=20797 read=11034
                                                               ->  Bitmap Index Scan on keyword_id_movie_keyword  (cost=0.00..435.05 rows=38749 width=0) (actual time=1.266..1.266 rows=41840.00 loops=3)
                                                                     Index Cond: (keyword_id = k.id)
                                                                     Index Searches: 3
                                                                     Buffers: shared hit=80 read=36
                                       ->  Index Scan using title_pkey on title t  (cost=0.43..0.49 rows=1 width=21) (actual time=0.002..0.002 rows=1.00 loops=68316)
                                             Index Cond: (id = mk.movie_id)
                                             Index Searches: 68316
                                             Buffers: shared hit=244410 read=28856
                                 ->  Index Scan using movie_id_cast_info on cast_info ci  (cost=0.44..1.36 rows=38 width=8) (actual time=0.003..0.040 rows=41.46 loops=68316)
                                       Index Cond: (movie_id = mk.movie_id)
                                       Index Searches: 68316
                                       Buffers: shared hit=2278284 read=670543
                           ->  Memoize  (cost=0.44..0.46 rows=1 width=4) (actual time=0.001..0.001 rows=1.00 loops=2832555)
                                 Cache Key: ci.person_id
                                 Cache Mode: logical
                                 Estimates: capacity=71064 distinct keys=71064 lookups=635491 hit percent=88.82%
                                 Hits: 724363  Misses: 200258  Evictions: 119594  Overflows: 0  Memory Usage: 8193kB
                                 Buffers: shared hit=1631500 read=349642
                                 Worker 0:  Hits: 744868  Misses: 209441  Evictions: 128778  Overflows: 0  Memory Usage: 8193kB
                                 Worker 1:  Hits: 745857  Misses: 207768  Evictions: 127108  Overflows: 0  Memory Usage: 8193kB
                                 ->  Index Only Scan using name_pkey on name n  (cost=0.43..0.45 rows=1 width=4) (actual time=0.003..0.003 rows=1.00 loops=617467)
                                       Index Cond: (id = ci.person_id)
                                       Heap Fetches: 0
                                       Index Searches: 617467
                                       Buffers: shared hit=1631500 read=349642
                     ->  Parallel Hash  (cost=15171.59..15171.59 rows=375559 width=20) (actual time=48.749..48.750 rows=300447.33 loops=3)
                           Buckets: 131072  Batches: 8  Memory Usage: 7296kB
                           Buffers: shared hit=282 read=11134, temp written=4116
                           ->  Parallel Seq Scan on aka_name an  (cost=0.00..15171.59 rows=375559 width=20) (actual time=0.095..18.852 rows=300447.33 loops=3)
                                 Buffers: shared hit=282 read=11134
 Planning:
   Buffers: shared hit=837 read=144
 Planning Time: 5.321 ms
 Execution Time: 2764.320 ms
(89 rows)