========================================================
 Detailed Analysis for Query: 31a 
 Source File: 31a.sql
 Date: Wed Dec 24 10:42:58 CST 2025
========================================================


################################################################
# CONFIGURATION: dp
################################################################

SET
SET
                                                                                                        QUERY PLAN                                                                                                        
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=11215.27..11215.28 rows=1 width=128) (actual time=3132.152..3132.154 rows=1.00 loops=1)
   Output: min(mi.info), min(mi_idx.info), min(n.name), min(t.title)
   Buffers: shared hit=4576275
   ->  Nested Loop  (cost=9.80..11215.26 rows=1 width=80) (actual time=24.981..3131.793 rows=1273.00 loops=1)
         Output: mi.info, mi_idx.info, n.name, t.title
         Inner Unique: true
         Join Filter: (mi.movie_id = t.id)
         Buffers: shared hit=4576275
         ->  Nested Loop  (cost=9.37..11214.76 rows=1 width=83) (actual time=24.967..3129.063 rows=1273.00 loops=1)
               Output: ci.movie_id, mc.movie_id, mi.info, mi.movie_id, mi_idx.info, mi_idx.movie_id, mk.movie_id, n.name
               Inner Unique: true
               Buffers: shared hit=4571183
               ->  Nested Loop  (cost=8.94..11214.07 rows=1 width=72) (actual time=24.936..3124.635 rows=1556.00 loops=1)
                     Output: ci.movie_id, ci.person_id, mc.movie_id, mi.info, mi.movie_id, mi_idx.info, mi_idx.movie_id, mk.movie_id
                     Inner Unique: true
                     Buffers: shared hit=4564959
                     ->  Nested Loop  (cost=8.52..11213.63 rows=1 width=76) (actual time=4.592..2748.458 rows=278364.00 loops=1)
                           Output: ci.movie_id, ci.person_id, mc.movie_id, mc.company_id, mi.info, mi.movie_id, mi_idx.info, mi_idx.movie_id, mk.movie_id
                           Join Filter: (mc.movie_id = mi.movie_id)
                           Buffers: shared hit=3451503
                           ->  Nested Loop  (cost=8.09..11213.02 rows=1 width=68) (actual time=4.576..2660.085 rows=21209.00 loops=1)
                                 Output: ci.movie_id, ci.person_id, mi.info, mi.movie_id, mi_idx.info, mi_idx.movie_id, mk.movie_id
                                 Join Filter: (ci.movie_id = mi.movie_id)
                                 Buffers: shared hit=3345181
                                 ->  Nested Loop  (cost=7.65..11211.41 rows=1 width=60) (actual time=1.932..1188.685 rows=31514.00 loops=1)
                                       Output: mi.info, mi.movie_id, mi_idx.info, mi_idx.movie_id, mk.movie_id
                                       Inner Unique: true
                                       Join Filter: (it1.id = mi.info_type_id)
                                       Rows Removed by Join Filter: 1792
                                       Buffers: shared hit=1449787
                                       ->  Nested Loop  (cost=7.65..11208.99 rows=1 width=64) (actual time=1.930..1151.122 rows=33306.00 loops=1)
                                             Output: mi_idx.info, mi_idx.movie_id, mi.info, mi.movie_id, mi.info_type_id, mk.movie_id
                                             Join Filter: (mi.movie_id = mi_idx.movie_id)
                                             Buffers: shared hit=1416481
                                             ->  Nested Loop  (cost=7.22..11200.19 rows=6 width=14) (actual time=1.885..237.043 rows=63701.00 loops=1)
                                                   Output: mi_idx.info, mi_idx.movie_id, mk.movie_id
                                                   Join Filter: (it2.id = mi_idx.info_type_id)
                                                   Rows Removed by Join Filter: 127988
                                                   Buffers: shared hit=349228
                                                   ->  Seq Scan on public.info_type it2  (cost=0.00..2.41 rows=1 width=4) (actual time=0.019..0.020 rows=1.00 loops=1)
                                                         Output: it2.id, it2.info
                                                         Filter: ((it2.info)::text = 'votes'::text)
                                                         Rows Removed by Filter: 112
                                                         Buffers: shared hit=1
                                                   ->  Nested Loop  (cost=7.22..11188.61 rows=733 width=18) (actual time=1.865..229.025 rows=191689.00 loops=1)
                                                         Output: mk.movie_id, mi_idx.info, mi_idx.movie_id, mi_idx.info_type_id
                                                         Buffers: shared hit=349227
                                                         ->  Nested Loop  (cost=6.79..11066.02 rows=236 width=4) (actual time=1.849..92.392 rows=76714.00 loops=1)
                                                               Output: mk.movie_id
                                                               Buffers: shared hit=54266
                                                               ->  Seq Scan on public.keyword k  (cost=0.00..3464.69 rows=7 width=4) (actual time=0.447..14.158 rows=7.00 loops=1)
                                                                     Output: k.id, k.keyword, k.phonetic_code
                                                                     Filter: (k.keyword = ANY ('{murder,violence,blood,gore,death,female-nudity,hospital}'::text[]))
                                                                     Rows Removed by Filter: 134163
                                                                     Buffers: shared hit=949
                                                               ->  Bitmap Heap Scan on public.movie_keyword mk  (cost=6.79..1082.86 rows=304 width=8) (actual time=1.238..10.578 rows=10959.14 loops=7)
                                                                     Output: mk.id, mk.movie_id, mk.keyword_id
                                                                     Recheck Cond: (k.id = mk.keyword_id)
                                                                     Heap Blocks: exact=53234
                                                                     Buffers: shared hit=53317
                                                                     ->  Bitmap Index Scan on keyword_id_movie_keyword  (cost=0.00..6.71 rows=304 width=0) (actual time=0.639..0.639 rows=10959.14 loops=7)
                                                                           Index Cond: (mk.keyword_id = k.id)
                                                                           Index Searches: 7
                                                                           Buffers: shared hit=83
                                                         ->  Index Scan using movie_id_movie_info_idx on public.movie_info_idx mi_idx  (cost=0.43..0.49 rows=3 width=14) (actual time=0.001..0.002 rows=2.50 loops=76714)
                                                               Output: mi_idx.id, mi_idx.movie_id, mi_idx.info_type_id, mi_idx.info, mi_idx.note
                                                               Index Cond: (mi_idx.movie_id = mk.movie_id)
                                                               Index Searches: 76714
                                                               Buffers: shared hit=294961
                                             ->  Index Scan using movie_id_movie_info on public.movie_info mi  (cost=0.43..1.45 rows=1 width=50) (actual time=0.014..0.014 rows=0.52 loops=63701)
                                                   Output: mi.id, mi.movie_id, mi.info_type_id, mi.info, mi.note
                                                   Index Cond: (mi.movie_id = mk.movie_id)
                                                   Filter: (mi.info = ANY ('{Horror,Thriller}'::text[]))
                                                   Rows Removed by Filter: 58
                                                   Index Searches: 63701
                                                   Buffers: shared hit=1067253
                                       ->  Seq Scan on public.info_type it1  (cost=0.00..2.41 rows=1 width=4) (actual time=0.000..0.001 rows=1.00 loops=33306)
                                             Output: it1.id, it1.info
                                             Filter: ((it1.info)::text = 'genres'::text)
                                             Rows Removed by Filter: 8
                                             Buffers: shared hit=33306
                                 ->  Index Scan using movie_id_cast_info on public.cast_info ci  (cost=0.44..1.60 rows=1 width=8) (actual time=0.037..0.047 rows=0.67 loops=31514)
                                       Output: ci.id, ci.person_id, ci.movie_id, ci.person_role_id, ci.note, ci.nr_order, ci.role_id
                                       Index Cond: (ci.movie_id = mk.movie_id)
                                       Filter: (ci.note = ANY ('{(writer),"(head writer)","(written by)",(story),"(story editor)"}'::text[]))
                                       Rows Removed by Filter: 58
                                       Index Searches: 31514
                                       Buffers: shared hit=1895394
                           ->  Index Scan using movie_id_movie_companies on public.movie_companies mc  (cost=0.43..0.54 rows=5 width=8) (actual time=0.002..0.003 rows=13.12 loops=21209)
                                 Output: mc.id, mc.movie_id, mc.company_id, mc.company_type_id, mc.note
                                 Index Cond: (mc.movie_id = mk.movie_id)
                                 Index Searches: 21209
                                 Buffers: shared hit=106322
                     ->  Index Scan using company_name_pkey on public.company_name cn  (cost=0.42..0.45 rows=1 width=4) (actual time=0.001..0.001 rows=0.01 loops=278364)
                           Output: cn.id, cn.name, cn.country_code, cn.imdb_id, cn.name_pcode_nf, cn.name_pcode_sf, cn.md5sum
                           Index Cond: (cn.id = mc.company_id)
                           Filter: (cn.name ~~ 'Lionsgate%'::text)
                           Rows Removed by Filter: 1
                           Index Searches: 278364
                           Buffers: shared hit=1113456
               ->  Index Scan using name_pkey on public.name n  (cost=0.43..0.68 rows=1 width=19) (actual time=0.003..0.003 rows=0.82 loops=1556)
                     Output: n.id, n.name, n.imdb_index, n.imdb_id, n.gender, n.name_pcode_cf, n.name_pcode_nf, n.surname_pcode, n.md5sum
                     Index Cond: (n.id = ci.person_id)
                     Filter: ((n.gender)::text = 'm'::text)
                     Rows Removed by Filter: 0
                     Index Searches: 1556
                     Buffers: shared hit=6224
         ->  Index Scan using title_pkey on public.title t  (cost=0.43..0.49 rows=1 width=21) (actual time=0.002..0.002 rows=1.00 loops=1273)
               Output: t.id, t.title, t.imdb_index, t.kind_id, t.production_year, t.imdb_id, t.phonetic_code, t.episode_of_id, t.season_nr, t.episode_nr, t.series_years, t.md5sum
               Index Cond: (t.id = mk.movie_id)
               Index Searches: 1273
               Buffers: shared hit=5092
 Planning:
   Buffers: shared hit=958
 Planning Time: 16.435 ms
 Execution Time: 3132.245 ms
(116 rows)


################################################################
# CONFIGURATION: goo_cost
################################################################

SET
SET
SET
                                                                                                            QUERY PLAN                                                                                                             
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=11316.64..11316.65 rows=1 width=128) (actual time=1527.644..1527.647 rows=1.00 loops=1)
   Output: min(mi.info), min(mi_idx.info), min(n.name), min(t.title)
   Buffers: shared hit=3579966
   ->  Nested Loop  (cost=9.80..11316.63 rows=1 width=80) (actual time=19.519..1527.366 rows=1273.00 loops=1)
         Output: mi.info, mi_idx.info, n.name, t.title
         Join Filter: (it1.id = mi.info_type_id)
         Rows Removed by Join Filter: 60
         Buffers: shared hit=3579966
         ->  Seq Scan on public.info_type it1  (cost=0.00..2.41 rows=1 width=4) (actual time=0.007..0.011 rows=1.00 loops=1)
               Output: it1.id, it1.info
               Filter: ((it1.info)::text = 'genres'::text)
               Rows Removed by Filter: 112
               Buffers: shared hit=1
         ->  Nested Loop  (cost=9.80..11314.21 rows=1 width=84) (actual time=19.511..1527.220 rows=1333.00 loops=1)
               Output: n.name, mi.info, mi.info_type_id, mi_idx.info, t.title
               Inner Unique: true
               Buffers: shared hit=3579965
               ->  Nested Loop  (cost=9.37..11313.53 rows=1 width=73) (actual time=19.491..1522.750 rows=1616.00 loops=1)
                     Output: ci.person_id, mi.info, mi.info_type_id, mi_idx.info, t.title
                     Join Filter: (ci.movie_id = t.id)
                     Buffers: shared hit=3573501
                     ->  Nested Loop  (cost=8.93..11311.92 rows=1 width=89) (actual time=19.281..1429.713 rows=1616.00 loops=1)
                           Output: mi.info, mi.movie_id, mi.info_type_id, mc.movie_id, mi_idx.info, mi_idx.movie_id, t.title, t.id, mk.movie_id
                           Join Filter: (mi.movie_id = t.id)
                           Buffers: shared hit=3395769
                           ->  Nested Loop  (cost=8.50..11310.45 rows=1 width=39) (actual time=7.509..1385.397 rows=1547.00 loops=1)
                                 Output: mc.movie_id, mi_idx.info, mi_idx.movie_id, t.title, t.id, mk.movie_id
                                 Inner Unique: true
                                 Buffers: shared hit=3359303
                                 ->  Nested Loop  (cost=8.08..11310.00 rows=1 width=43) (actual time=2.053..642.984 rows=598256.00 loops=1)
                                       Output: mc.movie_id, mc.company_id, mi_idx.info, mi_idx.movie_id, t.title, t.id, mk.movie_id
                                       Join Filter: (mc.movie_id = t.id)
                                       Buffers: shared hit=966279
                                       ->  Nested Loop  (cost=7.65..11309.40 rows=1 width=35) (actual time=2.037..414.073 rows=63701.00 loops=1)
                                             Output: mi_idx.info, mi_idx.movie_id, t.title, t.id, mk.movie_id
                                             Join Filter: (it2.id = mi_idx.info_type_id)
                                             Rows Removed by Join Filter: 127988
                                             Buffers: shared hit=656084
                                             ->  Seq Scan on public.info_type it2  (cost=0.00..2.41 rows=1 width=4) (actual time=0.004..0.006 rows=1.00 loops=1)
                                                   Output: it2.id, it2.info
                                                   Filter: ((it2.info)::text = 'votes'::text)
                                                   Rows Removed by Filter: 112
                                                   Buffers: shared hit=1
                                             ->  Nested Loop  (cost=7.65..11305.38 rows=129 width=39) (actual time=2.032..406.031 rows=191689.00 loops=1)
                                                   Output: mi_idx.info, mi_idx.movie_id, mi_idx.info_type_id, t.title, t.id, mk.movie_id
                                                   Buffers: shared hit=656083
                                                   ->  Nested Loop  (cost=7.22..11181.02 rows=236 width=25) (actual time=2.012..269.076 rows=76714.00 loops=1)
                                                         Output: t.title, t.id, mk.movie_id
                                                         Inner Unique: true
                                                         Buffers: shared hit=361122
                                                         ->  Nested Loop  (cost=6.79..11066.02 rows=236 width=4) (actual time=1.995..94.770 rows=76714.00 loops=1)
                                                               Output: mk.movie_id
                                                               Buffers: shared hit=54266
                                                               ->  Seq Scan on public.keyword k  (cost=0.00..3464.69 rows=7 width=4) (actual time=0.462..14.549 rows=7.00 loops=1)
                                                                     Output: k.id, k.keyword, k.phonetic_code
                                                                     Filter: (k.keyword = ANY ('{murder,violence,blood,gore,death,female-nudity,hospital}'::text[]))
                                                                     Rows Removed by Filter: 134163
                                                                     Buffers: shared hit=949
                                                               ->  Bitmap Heap Scan on public.movie_keyword mk  (cost=6.79..1082.86 rows=304 width=8) (actual time=1.241..10.881 rows=10959.14 loops=7)
                                                                     Output: mk.id, mk.movie_id, mk.keyword_id
                                                                     Recheck Cond: (k.id = mk.keyword_id)
                                                                     Heap Blocks: exact=53234
                                                                     Buffers: shared hit=53317
                                                                     ->  Bitmap Index Scan on keyword_id_movie_keyword  (cost=0.00..6.71 rows=304 width=0) (actual time=0.641..0.642 rows=10959.14 loops=7)
                                                                           Index Cond: (mk.keyword_id = k.id)
                                                                           Index Searches: 7
                                                                           Buffers: shared hit=83
                                                         ->  Index Scan using title_pkey on public.title t  (cost=0.43..0.49 rows=1 width=21) (actual time=0.002..0.002 rows=1.00 loops=76714)
                                                               Output: t.id, t.title, t.imdb_index, t.kind_id, t.production_year, t.imdb_id, t.phonetic_code, t.episode_of_id, t.season_nr, t.episode_nr, t.series_years, t.md5sum
                                                               Index Cond: (t.id = mk.movie_id)
                                                               Index Searches: 76714
                                                               Buffers: shared hit=306856
                                                   ->  Index Scan using movie_id_movie_info_idx on public.movie_info_idx mi_idx  (cost=0.43..0.50 rows=3 width=14) (actual time=0.001..0.002 rows=2.50 loops=76714)
                                                         Output: mi_idx.id, mi_idx.movie_id, mi_idx.info_type_id, mi_idx.info, mi_idx.note
                                                         Index Cond: (mi_idx.movie_id = t.id)
                                                         Index Searches: 76714
                                                         Buffers: shared hit=294961
                                       ->  Index Scan using movie_id_movie_companies on public.movie_companies mc  (cost=0.43..0.54 rows=5 width=8) (actual time=0.002..0.003 rows=9.39 loops=63701)
                                             Output: mc.id, mc.movie_id, mc.company_id, mc.company_type_id, mc.note
                                             Index Cond: (mc.movie_id = mk.movie_id)
                                             Index Searches: 63701
                                             Buffers: shared hit=310195
                                 ->  Index Scan using company_name_pkey on public.company_name cn  (cost=0.42..0.45 rows=1 width=4) (actual time=0.001..0.001 rows=0.00 loops=598256)
                                       Output: cn.id, cn.name, cn.country_code, cn.imdb_id, cn.name_pcode_nf, cn.name_pcode_sf, cn.md5sum
                                       Index Cond: (cn.id = mc.company_id)
                                       Filter: (cn.name ~~ 'Lionsgate%'::text)
                                       Rows Removed by Filter: 1
                                       Index Searches: 598256
                                       Buffers: shared hit=2393024
                           ->  Index Scan using movie_id_movie_info on public.movie_info mi  (cost=0.43..1.45 rows=1 width=50) (actual time=0.028..0.028 rows=1.04 loops=1547)
                                 Output: mi.id, mi.movie_id, mi.info_type_id, mi.info, mi.note
                                 Index Cond: (mi.movie_id = mk.movie_id)
                                 Filter: (mi.info = ANY ('{Horror,Thriller}'::text[]))
                                 Rows Removed by Filter: 165
                                 Index Searches: 1547
                                 Buffers: shared hit=36466
                     ->  Index Scan using movie_id_cast_info on public.cast_info ci  (cost=0.44..1.60 rows=1 width=8) (actual time=0.040..0.057 rows=1.00 loops=1616)
                           Output: ci.id, ci.person_id, ci.movie_id, ci.person_role_id, ci.note, ci.nr_order, ci.role_id
                           Index Cond: (ci.movie_id = mk.movie_id)
                           Filter: (ci.note = ANY ('{(writer),"(head writer)","(written by)",(story),"(story editor)"}'::text[]))
                           Rows Removed by Filter: 109
                           Index Searches: 1616
                           Buffers: shared hit=177732
               ->  Index Scan using name_pkey on public.name n  (cost=0.43..0.68 rows=1 width=19) (actual time=0.003..0.003 rows=0.82 loops=1616)
                     Output: n.id, n.name, n.imdb_index, n.imdb_id, n.gender, n.name_pcode_cf, n.name_pcode_nf, n.surname_pcode, n.md5sum
                     Index Cond: (n.id = ci.person_id)
                     Filter: ((n.gender)::text = 'm'::text)
                     Rows Removed by Filter: 0
                     Index Searches: 1616
                     Buffers: shared hit=6464
 Planning:
   Buffers: shared hit=958
 Planning Time: 2.541 ms
 Execution Time: 1527.726 ms
(114 rows)


################################################################
# CONFIGURATION: goo_result_size
################################################################

SET
SET
SET
                                                                                                         QUERY PLAN                                                                                                         
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=24545.71..24545.72 rows=1 width=128) (actual time=229.532..229.536 rows=1.00 loops=1)
   Output: min(mi.info), min(mi_idx.info), min(n.name), min(t.title)
   Buffers: shared hit=295947
   ->  Nested Loop  (cost=11071.85..24545.70 rows=1 width=80) (actual time=93.666..229.387 rows=1273.00 loops=1)
         Output: mi.info, mi_idx.info, n.name, t.title
         Inner Unique: true
         Buffers: shared hit=295947
         ->  Nested Loop  (cost=11071.70..24545.52 rows=1 width=84) (actual time=93.652..228.628 rows=1333.00 loops=1)
               Output: mi.info, mi.info_type_id, t.title, mi_idx.info, n.name
               Join Filter: (mi.movie_id = t.id)
               Buffers: shared hit=293281
               ->  Nested Loop  (cost=11071.27..24544.05 rows=1 width=58) (actual time=92.615..202.471 rows=1157.00 loops=1)
                     Output: t.title, t.id, mi_idx.info, mi_idx.movie_id, n.name, ci.movie_id, mk.movie_id, mc.movie_id
                     Inner Unique: true
                     Join Filter: (mi_idx.movie_id = t.id)
                     Buffers: shared hit=264986
                     ->  Nested Loop  (cost=11070.84..24543.55 rows=1 width=37) (actual time=92.602..200.462 rows=1157.00 loops=1)
                           Output: mi_idx.info, mi_idx.movie_id, n.name, ci.movie_id, mk.movie_id, mc.movie_id
                           Inner Unique: true
                           Buffers: shared hit=260358
                           ->  Nested Loop  (cost=11070.70..24543.37 rows=1 width=41) (actual time=92.593..198.801 rows=3549.00 loops=1)
                                 Output: mi_idx.info, mi_idx.movie_id, mi_idx.info_type_id, n.name, ci.movie_id, mk.movie_id, mc.movie_id
                                 Join Filter: (ci.movie_id = mi_idx.movie_id)
                                 Buffers: shared hit=253260
                                 ->  Nested Loop  (cost=11070.27..24542.84 rows=1 width=27) (actual time=92.579..196.573 rows=1158.00 loops=1)
                                       Output: n.name, ci.movie_id, mk.movie_id, mc.movie_id
                                       Inner Unique: true
                                       Buffers: shared hit=248531
                                       ->  Nested Loop  (cost=11069.84..24542.16 rows=1 width=16) (actual time=92.566..193.266 rows=1472.00 loops=1)
                                             Output: ci.movie_id, ci.person_id, mk.movie_id, mc.movie_id
                                             Buffers: shared hit=242643
                                             ->  Hash Join  (cost=11069.40..24540.55 rows=1 width=8) (actual time=92.478..108.146 rows=1551.00 loops=1)
                                                   Output: mk.movie_id, mc.movie_id
                                                   Hash Cond: (mc.movie_id = mk.movie_id)
                                                   Buffers: shared hit=58378
                                                   ->  Nested Loop  (cost=0.43..13470.62 rows=255 width=4) (actual time=0.322..15.379 rows=1814.00 loops=1)
                                                         Output: mc.movie_id
                                                         Buffers: shared hit=4112
                                                         ->  Seq Scan on public.company_name cn  (cost=0.00..5932.46 rows=23 width=4) (actual time=0.302..13.204 rows=10.00 loops=1)
                                                               Output: cn.id, cn.name, cn.country_code, cn.imdb_id, cn.name_pcode_nf, cn.name_pcode_sf, cn.md5sum
                                                               Filter: (cn.name ~~ 'Lionsgate%'::text)
                                                               Rows Removed by Filter: 234987
                                                               Buffers: shared hit=2995
                                                         ->  Index Scan using company_id_movie_companies on public.movie_companies mc  (cost=0.43..326.42 rows=133 width=8) (actual time=0.008..0.207 rows=181.40 loops=10)
                                                               Output: mc.id, mc.movie_id, mc.company_id, mc.company_type_id, mc.note
                                                               Index Cond: (mc.company_id = cn.id)
                                                               Index Searches: 10
                                                               Buffers: shared hit=1117
                                                   ->  Hash  (cost=11066.02..11066.02 rows=236 width=4) (actual time=92.146..92.146 rows=76714.00 loops=1)
                                                         Output: mk.movie_id
                                                         Buckets: 131072 (originally 1024)  Batches: 1 (originally 1)  Memory Usage: 3721kB
                                                         Buffers: shared hit=54266
                                                         ->  Nested Loop  (cost=6.79..11066.02 rows=236 width=4) (actual time=1.854..88.178 rows=76714.00 loops=1)
                                                               Output: mk.movie_id
                                                               Buffers: shared hit=54266
                                                               ->  Seq Scan on public.keyword k  (cost=0.00..3464.69 rows=7 width=4) (actual time=0.429..14.495 rows=7.00 loops=1)
                                                                     Output: k.id, k.keyword, k.phonetic_code
                                                                     Filter: (k.keyword = ANY ('{murder,violence,blood,gore,death,female-nudity,hospital}'::text[]))
                                                                     Rows Removed by Filter: 134163
                                                                     Buffers: shared hit=949
                                                               ->  Bitmap Heap Scan on public.movie_keyword mk  (cost=6.79..1082.86 rows=304 width=8) (actual time=1.184..9.975 rows=10959.14 loops=7)
                                                                     Output: mk.id, mk.movie_id, mk.keyword_id
                                                                     Recheck Cond: (k.id = mk.keyword_id)
                                                                     Heap Blocks: exact=53234
                                                                     Buffers: shared hit=53317
                                                                     ->  Bitmap Index Scan on keyword_id_movie_keyword  (cost=0.00..6.71 rows=304 width=0) (actual time=0.579..0.579 rows=10959.14 loops=7)
                                                                           Index Cond: (mk.keyword_id = k.id)
                                                                           Index Searches: 7
                                                                           Buffers: shared hit=83
                                             ->  Index Scan using movie_id_cast_info on public.cast_info ci  (cost=0.44..1.60 rows=1 width=8) (actual time=0.040..0.055 rows=0.95 loops=1551)
                                                   Output: ci.id, ci.person_id, ci.movie_id, ci.person_role_id, ci.note, ci.nr_order, ci.role_id
                                                   Index Cond: (ci.movie_id = mk.movie_id)
                                                   Filter: (ci.note = ANY ('{(writer),"(head writer)","(written by)",(story),"(story editor)"}'::text[]))
                                                   Rows Removed by Filter: 119
                                                   Index Searches: 1551
                                                   Buffers: shared hit=184265
                                       ->  Index Scan using name_pkey on public.name n  (cost=0.43..0.68 rows=1 width=19) (actual time=0.002..0.002 rows=0.79 loops=1472)
                                             Output: n.id, n.name, n.imdb_index, n.imdb_id, n.gender, n.name_pcode_cf, n.name_pcode_nf, n.surname_pcode, n.md5sum
                                             Index Cond: (n.id = ci.person_id)
                                             Filter: ((n.gender)::text = 'm'::text)
                                             Rows Removed by Filter: 0
                                             Index Searches: 1472
                                             Buffers: shared hit=5888
                                 ->  Index Scan using movie_id_movie_info_idx on public.movie_info_idx mi_idx  (cost=0.43..0.49 rows=3 width=14) (actual time=0.001..0.002 rows=3.06 loops=1158)
                                       Output: mi_idx.id, mi_idx.movie_id, mi_idx.info_type_id, mi_idx.info, mi_idx.note
                                       Index Cond: (mi_idx.movie_id = mk.movie_id)
                                       Index Searches: 1158
                                       Buffers: shared hit=4729
                           ->  Index Scan using info_type_pkey on public.info_type it2  (cost=0.14..0.16 rows=1 width=4) (actual time=0.000..0.000 rows=0.33 loops=3549)
                                 Output: it2.id, it2.info
                                 Index Cond: (it2.id = mi_idx.info_type_id)
                                 Filter: ((it2.info)::text = 'votes'::text)
                                 Rows Removed by Filter: 1
                                 Index Searches: 3549
                                 Buffers: shared hit=7098
                     ->  Index Scan using title_pkey on public.title t  (cost=0.43..0.49 rows=1 width=21) (actual time=0.002..0.002 rows=1.00 loops=1157)
                           Output: t.id, t.title, t.imdb_index, t.kind_id, t.production_year, t.imdb_id, t.phonetic_code, t.episode_of_id, t.season_nr, t.episode_nr, t.series_years, t.md5sum
                           Index Cond: (t.id = mk.movie_id)
                           Index Searches: 1157
                           Buffers: shared hit=4628
               ->  Index Scan using movie_id_movie_info on public.movie_info mi  (cost=0.43..1.45 rows=1 width=50) (actual time=0.022..0.022 rows=1.15 loops=1157)
                     Output: mi.id, mi.movie_id, mi.info_type_id, mi.info, mi.note
                     Index Cond: (mi.movie_id = mk.movie_id)
                     Filter: (mi.info = ANY ('{Horror,Thriller}'::text[]))
                     Rows Removed by Filter: 190
                     Index Searches: 1157
                     Buffers: shared hit=28295
         ->  Index Scan using info_type_pkey on public.info_type it1  (cost=0.14..0.16 rows=1 width=4) (actual time=0.000..0.000 rows=0.95 loops=1333)
               Output: it1.id, it1.info
               Index Cond: (it1.id = mi.info_type_id)
               Filter: ((it1.info)::text = 'genres'::text)
               Rows Removed by Filter: 0
               Index Searches: 1333
               Buffers: shared hit=2666
 Planning:
   Buffers: shared hit=958
 Planning Time: 2.470 ms
 Execution Time: 229.626 ms
(118 rows)


################################################################
# CONFIGURATION: geqo
################################################################

SET
SET
                                                                                                        QUERY PLAN                                                                                                        
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=11215.27..11215.28 rows=1 width=128) (actual time=3302.846..3302.848 rows=1.00 loops=1)
   Output: min(mi.info), min(mi_idx.info), min(n.name), min(t.title)
   Buffers: shared hit=4334248
   ->  Nested Loop  (cost=9.80..11215.26 rows=1 width=80) (actual time=25.058..3302.424 rows=1273.00 loops=1)
         Output: mi.info, mi_idx.info, n.name, t.title
         Inner Unique: true
         Buffers: shared hit=4334248
         ->  Nested Loop  (cost=9.38..11214.81 rows=1 width=84) (actual time=9.873..3007.909 rows=186510.00 loops=1)
               Output: n.name, mi_idx.info, mi.info, t.title, mc.company_id
               Join Filter: (mc.movie_id = t.id)
               Buffers: shared hit=3588208
               ->  Nested Loop  (cost=8.95..11214.21 rows=1 width=100) (actual time=9.845..2943.226 rows=12984.00 loops=1)
                     Output: n.name, mk.movie_id, mi_idx.info, mi_idx.movie_id, mi.info, mi.movie_id, t.title, t.id, ci.movie_id
                     Inner Unique: true
                     Buffers: shared hit=3522768
                     ->  Nested Loop  (cost=8.52..11213.52 rows=1 width=89) (actual time=4.668..2861.690 rows=21209.00 loops=1)
                           Output: mk.movie_id, mi_idx.info, mi_idx.movie_id, mi.info, mi.movie_id, t.title, t.id, ci.movie_id, ci.person_id
                           Join Filter: (ci.movie_id = t.id)
                           Buffers: shared hit=3437932
                           ->  Nested Loop  (cost=8.08..11211.91 rows=1 width=81) (actual time=1.989..1299.017 rows=31514.00 loops=1)
                                 Output: mk.movie_id, mi_idx.info, mi_idx.movie_id, mi.info, mi.movie_id, t.title, t.id
                                 Inner Unique: true
                                 Join Filter: (mi.movie_id = t.id)
                                 Buffers: shared hit=1542538
                                 ->  Nested Loop  (cost=7.65..11211.41 rows=1 width=60) (actual time=1.978..1211.081 rows=31514.00 loops=1)
                                       Output: mk.movie_id, mi_idx.info, mi_idx.movie_id, mi.info, mi.movie_id
                                       Join Filter: (it1.id = mi.info_type_id)
                                       Rows Removed by Join Filter: 1792
                                       Buffers: shared hit=1416482
                                       ->  Seq Scan on public.info_type it1  (cost=0.00..2.41 rows=1 width=4) (actual time=0.017..0.021 rows=1.00 loops=1)
                                             Output: it1.id, it1.info
                                             Filter: ((it1.info)::text = 'genres'::text)
                                             Rows Removed by Filter: 112
                                             Buffers: shared hit=1
                                       ->  Nested Loop  (cost=7.65..11208.99 rows=1 width=64) (actual time=1.960..1208.282 rows=33306.00 loops=1)
                                             Output: mk.movie_id, mi_idx.info, mi_idx.movie_id, mi.info, mi.movie_id, mi.info_type_id
                                             Join Filter: (mi.movie_id = mi_idx.movie_id)
                                             Buffers: shared hit=1416481
                                             ->  Nested Loop  (cost=7.22..11200.19 rows=6 width=14) (actual time=1.921..250.823 rows=63701.00 loops=1)
                                                   Output: mk.movie_id, mi_idx.info, mi_idx.movie_id
                                                   Join Filter: (it2.id = mi_idx.info_type_id)
                                                   Rows Removed by Join Filter: 127988
                                                   Buffers: shared hit=349228
                                                   ->  Seq Scan on public.info_type it2  (cost=0.00..2.41 rows=1 width=4) (actual time=0.004..0.007 rows=1.00 loops=1)
                                                         Output: it2.id, it2.info
                                                         Filter: ((it2.info)::text = 'votes'::text)
                                                         Rows Removed by Filter: 112
                                                         Buffers: shared hit=1
                                                   ->  Nested Loop  (cost=7.22..11188.61 rows=733 width=18) (actual time=1.915..242.485 rows=191689.00 loops=1)
                                                         Output: mk.movie_id, mi_idx.info, mi_idx.movie_id, mi_idx.info_type_id
                                                         Buffers: shared hit=349227
                                                         ->  Nested Loop  (cost=6.79..11066.02 rows=236 width=4) (actual time=1.899..99.483 rows=76714.00 loops=1)
                                                               Output: mk.movie_id
                                                               Buffers: shared hit=54266
                                                               ->  Seq Scan on public.keyword k  (cost=0.00..3464.69 rows=7 width=4) (actual time=0.464..14.890 rows=7.00 loops=1)
                                                                     Output: k.id, k.keyword, k.phonetic_code
                                                                     Filter: (k.keyword = ANY ('{murder,violence,blood,gore,death,female-nudity,hospital}'::text[]))
                                                                     Rows Removed by Filter: 134163
                                                                     Buffers: shared hit=949
                                                               ->  Bitmap Heap Scan on public.movie_keyword mk  (cost=6.79..1082.86 rows=304 width=8) (actual time=1.228..11.443 rows=10959.14 loops=7)
                                                                     Output: mk.id, mk.movie_id, mk.keyword_id
                                                                     Recheck Cond: (k.id = mk.keyword_id)
                                                                     Heap Blocks: exact=53234
                                                                     Buffers: shared hit=53317
                                                                     ->  Bitmap Index Scan on keyword_id_movie_keyword  (cost=0.00..6.71 rows=304 width=0) (actual time=0.627..0.627 rows=10959.14 loops=7)
                                                                           Index Cond: (mk.keyword_id = k.id)
                                                                           Index Searches: 7
                                                                           Buffers: shared hit=83
                                                         ->  Index Scan using movie_id_movie_info_idx on public.movie_info_idx mi_idx  (cost=0.43..0.49 rows=3 width=14) (actual time=0.001..0.002 rows=2.50 loops=76714)
                                                               Output: mi_idx.id, mi_idx.movie_id, mi_idx.info_type_id, mi_idx.info, mi_idx.note
                                                               Index Cond: (mi_idx.movie_id = mk.movie_id)
                                                               Index Searches: 76714
                                                               Buffers: shared hit=294961
                                             ->  Index Scan using movie_id_movie_info on public.movie_info mi  (cost=0.43..1.45 rows=1 width=50) (actual time=0.015..0.015 rows=0.52 loops=63701)
                                                   Output: mi.id, mi.movie_id, mi.info_type_id, mi.info, mi.note
                                                   Index Cond: (mi.movie_id = mk.movie_id)
                                                   Filter: (mi.info = ANY ('{Horror,Thriller}'::text[]))
                                                   Rows Removed by Filter: 58
                                                   Index Searches: 63701
                                                   Buffers: shared hit=1067253
                                 ->  Index Scan using title_pkey on public.title t  (cost=0.43..0.49 rows=1 width=21) (actual time=0.003..0.003 rows=1.00 loops=31514)
                                       Output: t.id, t.title, t.imdb_index, t.kind_id, t.production_year, t.imdb_id, t.phonetic_code, t.episode_of_id, t.season_nr, t.episode_nr, t.series_years, t.md5sum
                                       Index Cond: (t.id = mk.movie_id)
                                       Index Searches: 31514
                                       Buffers: shared hit=126056
                           ->  Index Scan using movie_id_cast_info on public.cast_info ci  (cost=0.44..1.60 rows=1 width=8) (actual time=0.039..0.049 rows=0.67 loops=31514)
                                 Output: ci.id, ci.person_id, ci.movie_id, ci.person_role_id, ci.note, ci.nr_order, ci.role_id
                                 Index Cond: (ci.movie_id = mk.movie_id)
                                 Filter: (ci.note = ANY ('{(writer),"(head writer)","(written by)",(story),"(story editor)"}'::text[]))
                                 Rows Removed by Filter: 58
                                 Index Searches: 31514
                                 Buffers: shared hit=1895394
                     ->  Index Scan using name_pkey on public.name n  (cost=0.43..0.68 rows=1 width=19) (actual time=0.004..0.004 rows=0.61 loops=21209)
                           Output: n.id, n.name, n.imdb_index, n.imdb_id, n.gender, n.name_pcode_cf, n.name_pcode_nf, n.surname_pcode, n.md5sum
                           Index Cond: (n.id = ci.person_id)
                           Filter: ((n.gender)::text = 'm'::text)
                           Rows Removed by Filter: 0
                           Index Searches: 21209
                           Buffers: shared hit=84836
               ->  Index Scan using movie_id_movie_companies on public.movie_companies mc  (cost=0.43..0.54 rows=5 width=8) (actual time=0.002..0.004 rows=14.36 loops=12984)
                     Output: mc.id, mc.movie_id, mc.company_id, mc.company_type_id, mc.note
                     Index Cond: (mc.movie_id = mk.movie_id)
                     Index Searches: 12984
                     Buffers: shared hit=65440
         ->  Index Scan using company_name_pkey on public.company_name cn  (cost=0.42..0.45 rows=1 width=4) (actual time=0.002..0.002 rows=0.01 loops=186510)
               Output: cn.id, cn.name, cn.country_code, cn.imdb_id, cn.name_pcode_nf, cn.name_pcode_sf, cn.md5sum
               Index Cond: (cn.id = mc.company_id)
               Filter: (cn.name ~~ 'Lionsgate%'::text)
               Rows Removed by Filter: 1
               Index Searches: 186510
               Buffers: shared hit=746040
 Planning:
   Buffers: shared hit=958
 Planning Time: 24.301 ms
 Execution Time: 3302.929 ms
(115 rows)

