JustPaste.it

EXPLAIN ANALYSE BUFFERS for https://dba.stackexchange.com/questions/324606/

Nested Loop Left Join  (cost=91.54..701.25 rows=25 width=2344) (actual time=79.314..1111.702 rows=25 loops=1)
  Buffers: shared hit=368639
  ->  Hash Left Join  (cost=91.39..666.25 rows=25 width=4700) (actual time=79.208..1109.716 rows=25 loops=1)
        Hash Cond: (cash_accounting_period.vending_machine_id = route_vending_machine.vending_machine_id)
        Buffers: shared hit=368639
        ->  Nested Loop Left Join  (cost=88.79..663.55 rows=25 width=4684) (actual time=79.169..1109.605 rows=25 loops=1)
              Buffers: shared hit=368638
              ->  Nested Loop Left Join  (cost=86.47..493.58 rows=25 width=4324) (actual time=71.640..1028.000 rows=25 loops=1)
                    Buffers: shared hit=350973
                    ->  Nested Loop Left Join  (cost=84.15..299.15 rows=25 width=3964) (actual time=0.556..1.491 rows=25 loops=1)
                          Buffers: shared hit=234
                          ->  Nested Loop Left Join  (cost=83.86..292.95 rows=25 width=3768) (actual time=0.550..1.389 rows=25 loops=1)
                                Buffers: shared hit=234
                                ->  Hash Right Join  (cost=83.58..121.45 rows=25 width=2651) (actual time=0.540..1.102 rows=25 loops=1)
                                      Hash Cond: (company.id = cash_accounting_period.client_id)
                                      Buffers: shared hit=159
                                      ->  Seq Scan on company  (cost=0.00..33.24 rows=724 width=351) (actual time=0.005..0.458 rows=724 loops=1)
                                            Buffers: shared hit=26
                                      ->  Hash  (cost=83.27..83.27 rows=25 width=2316) (actual time=0.452..0.456 rows=25 loops=1)
                                            Buckets: 1024  Batches: 1  Memory Usage: 41kB
                                            Buffers: shared hit=133
                                            ->  Hash Right Join  (cost=64.30..83.27 rows=25 width=2316) (actual time=0.422..0.436 rows=25 loops=1)
                                                  Hash Cond: (closed_by.id = cash_accounting_period.closed_by)
                                                  Buffers: shared hit=133
"                                                  ->  Seq Scan on ""user"" closed_by  (cost=0.00..17.06 rows=506 width=212) (actual time=0.011..0.216 rows=506 loops=1)"
                                                        Buffers: shared hit=12
                                                  ->  Hash  (cost=63.99..63.99 rows=25 width=2120) (actual time=0.150..0.152 rows=25 loops=1)
                                                        Buckets: 1024  Batches: 1  Memory Usage: 41kB
                                                        Buffers: shared hit=121
                                                        ->  Limit  (cost=2.70..63.74 rows=25 width=2120) (actual time=0.135..0.140 rows=25 loops=1)
                                                              Buffers: shared hit=121
                                                              ->  Incremental Sort  (cost=2.70..18772.11 rows=7688 width=2120) (actual time=0.134..0.136 rows=25 loops=1)
"                                                                    Sort Key: cash_accounting_period.closed_at DESC, cash_accounting_period.created_at DESC"
                                                                    Presorted Key: cash_accounting_period.closed_at
                                                                    Full-sort Groups: 1  Sort Method: quicksort  Average Memory: 73kB  Peak Memory: 73kB
                                                                    Buffers: shared hit=121
                                                                    ->  Index Scan Backward using cash_accounting_period_closed_at_index on cash_accounting_period  (cost=0.29..18426.64 rows=7688 width=2120) (actual time=0.019..0.112 rows=26 loops=1)
                                                                          Index Cond: ((closed_at IS NOT NULL) AND (closed_at IS NOT NULL))
                                                                          Filter: (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid)
                                                                          Rows Removed by Filter: 93
                                                                          Buffers: shared hit=121
                                ->  Index Scan using vending_machine_id_pk on vending_machine  (cost=0.28..6.86 rows=1 width=1117) (actual time=0.008..0.008 rows=1 loops=25)
                                      Index Cond: (id = cash_accounting_period.vending_machine_id)
                                      Buffers: shared hit=75
                          ->  Memoize  (cost=0.28..2.86 rows=1 width=212) (actual time=0.001..0.001 rows=0 loops=25)
                                Cache Key: cash_accounting_period.verified_by
                                Cache Mode: logical
                                Hits: 24  Misses: 1  Evictions: 0  Overflows: 0  Memory Usage: 1kB
"                                ->  Index Scan using user_id_pk on ""user"" verified_by  (cost=0.27..2.85 rows=1 width=212) (actual time=0.001..0.001 rows=0 loops=1)"
                                      Index Cond: (id = cash_accounting_period.verified_by)
                    ->  Subquery Scan on vend_total  (cost=2.33..7.77 rows=1 width=360) (actual time=41.057..41.057 rows=1 loops=25)
                          Buffers: shared hit=350739
                          ->  Limit  (cost=2.33..7.76 rows=1 width=336) (actual time=41.053..41.053 rows=1 loops=25)
                                Buffers: shared hit=350739
                                ->  Subquery Scan on totals  (cost=2.33..29712.07 rows=5472 width=336) (actual time=41.052..41.052 rows=1 loops=25)
                                      Buffers: shared hit=350739
                                      ->  GroupAggregate  (cost=2.33..29657.35 rows=5472 width=454) (actual time=41.049..41.050 rows=1 loops=25)
"                                            Group Key: vend.vending_machine_id, vending_machine.name"
                                            Buffers: shared hit=350739
                                            ->  Nested Loop  (cost=2.33..27705.08 rows=9731 width=143) (actual time=0.056..28.336 rows=16776 loops=25)
                                                  Buffers: shared hit=350739
                                                  ->  Append  (cost=0.42..16982.09 rows=9731 width=25) (actual time=0.037..19.311 rows=16776 loops=25)
                                                        Buffers: shared hit=350719
                                                        ->  Index Scan using vend_opt_zinvending_2020_merchant_id_vending_machine_id_ti_idx1 on vend_opt_zinvending_2020 vend_1  (cost=0.42..3354.26 rows=1946 width=25) (actual time=0.012..3.261 rows=3716 loops=25)
"                                                              Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                              Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                              Buffers: shared hit=62717
                                                        ->  Index Scan using vend_opt_zinvending_2021_merchant_id_vending_machine_id_ti_idx1 on vend_opt_zinvending_2021 vend_2  (cost=0.43..6092.80 rows=3525 width=25) (actual time=0.012..6.966 rows=6564 loops=25)
"                                                              Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                              Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                              Buffers: shared hit=145183
                                                        ->  Index Scan using vend_opt_zinvending_2022_01_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_01 vend_3  (cost=0.42..576.89 rows=329 width=25) (actual time=0.012..0.598 rows=541 loops=25)
"                                                              Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                              Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                              Buffers: shared hit=12045
                                                        ->  Index Scan using vend_opt_zinvending_2022_02_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_02 vend_4  (cost=0.42..569.79 rows=325 width=25) (actual time=0.011..0.556 rows=525 loops=25)
"                                                              Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                              Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                              Buffers: shared hit=11318
                                                        ->  Index Scan using vend_opt_zinvending_2022_03_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_03 vend_5  (cost=0.42..692.88 rows=396 width=25) (actual time=0.011..0.623 rows=576 loops=25)
"                                                              Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                              Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                              Buffers: shared hit=12521
                                                        ->  Index Scan using vend_opt_zinvending_2022_04_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_04 vend_6  (cost=0.42..575.07 rows=326 width=25) (actual time=0.011..0.503 rows=452 loops=25)
"                                                              Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                              Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                              Buffers: shared hit=10021
                                                        ->  Index Scan using vend_opt_zinvending_2022_05_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_05 vend_7  (cost=0.42..641.36 rows=365 width=25) (actual time=0.012..0.635 rows=545 loops=25)
"                                                              Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                              Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                              Buffers: shared hit=12296
                                                        ->  Index Scan using vend_opt_zinvending_2022_06_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_06 vend_8  (cost=0.42..585.72 rows=332 width=25) (actual time=0.011..0.580 rows=485 loops=25)
"                                                              Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                              Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                              Buffers: shared hit=11164
                                                        ->  Index Scan using vend_opt_zinvending_2022_07_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_07 vend_9  (cost=0.42..617.70 rows=351 width=25) (actual time=0.011..0.569 rows=504 loops=25)
"                                                              Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                              Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                              Buffers: shared hit=11376
                                                        ->  Index Scan using vend_opt_zinvending_2022_08_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_08 vend_10  (cost=0.42..580.39 rows=329 width=25) (actual time=0.012..0.522 rows=457 loops=25)
"                                                              Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                              Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                              Buffers: shared hit=10280
                                                        ->  Index Scan using vend_opt_zinvending_2022_09_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_09 vend_11  (cost=0.42..631.87 rows=358 width=25) (actual time=0.012..0.609 rows=546 loops=25)
"                                                              Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                              Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                              Buffers: shared hit=12217
                                                        ->  Index Scan using vend_opt_zinvending_2022_10_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_10 vend_12  (cost=0.42..651.96 rows=369 width=25) (actual time=0.012..0.653 rows=582 loops=25)
"                                                              Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                              Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                              Buffers: shared hit=13268
                                                        ->  Index Scan using vend_opt_zinvending_2022_11_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_11 vend_13  (cost=0.42..694.61 rows=395 width=25) (actual time=0.011..0.719 rows=685 loops=25)
"                                                              Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                              Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                              Buffers: shared hit=13930
                                                        ->  Index Scan using vend_opt_zinvending_2022_12_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_12 vend_14  (cost=0.42..614.09 rows=347 width=25) (actual time=0.013..0.614 rows=585 loops=25)
"                                                              Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                              Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                              Buffers: shared hit=12050
                                                        ->  Index Scan using vend_opt_zinvending_2023_01_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2023_01 vend_15  (cost=0.28..39.05 rows=18 width=25) (actual time=0.008..0.019 rows=12 loops=25)
"                                                              Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                              Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                              Buffers: shared hit=281
                                                        ->  Seq Scan on vend_opt_zinvending_2023_02 vend_16  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                              Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                        ->  Seq Scan on vend_opt_zinvending_2023_03 vend_17  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                              Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                        ->  Seq Scan on vend_opt_zinvending_2023_04 vend_18  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                              Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                        ->  Seq Scan on vend_opt_zinvending_2023_05 vend_19  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                              Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                        ->  Seq Scan on vend_opt_zinvending_2023_06 vend_20  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                              Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                        ->  Seq Scan on vend_opt_zinvending_2023_07 vend_21  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                              Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                        ->  Seq Scan on vend_opt_zinvending_2023_08 vend_22  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                              Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                        ->  Seq Scan on vend_opt_zinvending_2023_09 vend_23  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                              Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                        ->  Seq Scan on vend_opt_zinvending_2023_10 vend_24  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                              Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                        ->  Seq Scan on vend_opt_zinvending_2023_11 vend_25  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                              Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                        ->  Seq Scan on vend_opt_zinvending_2023_12 vend_26  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                              Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                        ->  Bitmap Heap Scan on vend_opt_zinvending_default vend_27  (cost=4.39..15.00 rows=9 width=25) (actual time=0.008..0.008 rows=2 loops=25)
"                                                              Recheck Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id) AND (""timestamp"" <= cash_accounting_period.closed_at) AND display AND (succeeded OR (succeeded IS NULL)))"
                                                              Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                              Heap Blocks: exact=2
                                                              Buffers: shared hit=52
                                                              ->  Bitmap Index Scan on vend_opt_zinvending_default_merchant_id_vending_machine_id_idx1  (cost=0.00..4.38 rows=9 width=0) (actual time=0.005..0.005 rows=2 loops=25)
"                                                                    Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                                    Buffers: shared hit=50
                                                  ->  Memoize  (cost=1.90..1.93 rows=1 width=0) (actual time=0.000..0.000 rows=1 loops=419405)
                                                        Cache Key: vend.vending_machine_id
                                                        Cache Mode: binary
                                                        Hits: 419385  Misses: 20  Evictions: 0  Overflows: 0  Memory Usage: 3kB
                                                        Buffers: shared hit=20
                                                        ->  Subquery Scan on subquery  (cost=1.89..1.92 rows=1 width=0) (actual time=0.010..0.010 rows=1 loops=20)
                                                              Buffers: shared hit=20
                                                              ->  Aggregate  (cost=1.89..1.91 rows=1 width=32) (actual time=0.009..0.009 rows=1 loops=20)
"                                                                    Filter: (NOT (COALESCE(array_agg(route_vending_machine_1.route_id), '{}'::uuid[]) && '{}'::uuid[]))"
                                                                    Buffers: shared hit=20
                                                                    ->  Seq Scan on route_vending_machine route_vending_machine_1  (cost=0.00..1.89 rows=1 width=16) (actual time=0.006..0.006 rows=0 loops=20)
                                                                          Filter: (vending_machine_id = vend.vending_machine_id)
                                                                          Rows Removed by Filter: 71
                                                                          Buffers: shared hit=20
              ->  Subquery Scan on vend_partial  (cost=2.32..6.79 rows=1 width=360) (actual time=3.260..3.260 rows=1 loops=25)
                    Buffers: shared hit=17665
                    ->  Limit  (cost=2.32..6.78 rows=1 width=336) (actual time=3.257..3.257 rows=1 loops=25)
                          Buffers: shared hit=17665
                          ->  Subquery Scan on totals_1  (cost=2.32..707.20 rows=158 width=336) (actual time=3.256..3.256 rows=1 loops=25)
                                Buffers: shared hit=17665
                                ->  GroupAggregate  (cost=2.32..705.62 rows=158 width=454) (actual time=3.252..3.252 rows=1 loops=25)
"                                      Group Key: vend_28.vending_machine_id, vending_machine.name"
                                      Buffers: shared hit=17665
                                      ->  Nested Loop  (cost=2.32..673.23 rows=158 width=151) (actual time=0.040..2.911 rows=381 loops=25)
                                            Buffers: shared hit=17665
                                            ->  Append  (cost=0.42..369.08 rows=158 width=33) (actual time=0.017..0.390 rows=381 loops=25)
                                                  Buffers: shared hit=8147
                                                  ->  Index Scan using vend_opt_zinvending_2020_merchant_id_vending_machine_id_ti_idx1 on vend_opt_zinvending_2020 vend_29  (cost=0.42..58.22 rows=29 width=25) (never executed)
"                                                        Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                        Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                  ->  Index Scan using vend_opt_zinvending_2021_merchant_id_vending_machine_id_ti_idx1 on vend_opt_zinvending_2021 vend_30  (cost=0.43..101.45 rows=53 width=25) (never executed)
"                                                        Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                        Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                  ->  Index Scan using vend_opt_zinvending_2022_01_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_01 vend_31  (cost=0.42..15.56 rows=5 width=25) (never executed)
"                                                        Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                        Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                  ->  Index Scan using vend_opt_zinvending_2022_02_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_02 vend_32  (cost=0.42..15.56 rows=5 width=25) (never executed)
"                                                        Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                        Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                  ->  Index Scan using vend_opt_zinvending_2022_03_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_03 vend_33  (cost=0.42..17.34 rows=6 width=25) (never executed)
"                                                        Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                        Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                  ->  Index Scan using vend_opt_zinvending_2022_04_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_04 vend_34  (cost=0.42..15.56 rows=5 width=25) (never executed)
"                                                        Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                        Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                  ->  Index Scan using vend_opt_zinvending_2022_05_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_05 vend_35  (cost=0.42..15.56 rows=5 width=25) (never executed)
"                                                        Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                        Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                  ->  Index Scan using vend_opt_zinvending_2022_06_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_06 vend_36  (cost=0.42..15.56 rows=5 width=25) (never executed)
"                                                        Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                        Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                  ->  Index Scan using vend_opt_zinvending_2022_07_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_07 vend_37  (cost=0.42..15.56 rows=5 width=25) (never executed)
"                                                        Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                        Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                  ->  Index Scan using vend_opt_zinvending_2022_08_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_08 vend_38  (cost=0.42..15.56 rows=5 width=25) (never executed)
"                                                        Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                        Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                  ->  Index Scan using vend_opt_zinvending_2022_09_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_09 vend_39  (cost=0.42..15.56 rows=5 width=25) (never executed)
"                                                        Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                        Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                  ->  Index Scan using vend_opt_zinvending_2022_10_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_10 vend_40  (cost=0.42..17.34 rows=6 width=25) (never executed)
"                                                        Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                        Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                  ->  Index Scan using vend_opt_zinvending_2022_11_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_11 vend_41  (cost=0.42..17.34 rows=6 width=25) (actual time=0.008..0.029 rows=26 loops=6)
"                                                        Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                        Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                        Buffers: shared hit=151
                                                  ->  Index Scan using vend_opt_zinvending_2022_12_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2022_12 vend_42  (cost=0.42..15.56 rows=5 width=25) (actual time=0.008..0.395 rows=455 loops=20)
"                                                        Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                        Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                        Buffers: shared hit=7740
                                                  ->  Index Scan using vend_opt_zinvending_2023_01_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_2023_01 vend_43  (cost=0.28..8.31 rows=1 width=25) (actual time=0.004..0.012 rows=10 loops=25)
"                                                        Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                        Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                                        Buffers: shared hit=256
                                                  ->  Seq Scan on vend_opt_zinvending_2023_02 vend_44  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                        Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                  ->  Seq Scan on vend_opt_zinvending_2023_03 vend_45  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                        Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                  ->  Seq Scan on vend_opt_zinvending_2023_04 vend_46  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                        Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                  ->  Seq Scan on vend_opt_zinvending_2023_05 vend_47  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                        Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                  ->  Seq Scan on vend_opt_zinvending_2023_06 vend_48  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                        Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                  ->  Seq Scan on vend_opt_zinvending_2023_07 vend_49  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                        Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                  ->  Seq Scan on vend_opt_zinvending_2023_08 vend_50  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                        Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                  ->  Seq Scan on vend_opt_zinvending_2023_09 vend_51  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                        Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                  ->  Seq Scan on vend_opt_zinvending_2023_10 vend_52  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                        Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                  ->  Seq Scan on vend_opt_zinvending_2023_11 vend_53  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                        Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                  ->  Seq Scan on vend_opt_zinvending_2023_12 vend_54  (cost=0.00..0.00 rows=1 width=138) (never executed)
"                                                        Filter: (display AND (succeeded OR (succeeded IS NULL)) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at) AND (merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid) AND (cash_accounting_period.vending_machine_id = vending_machine_id))"
                                                  ->  Index Scan using vend_opt_zinvending_default_merchant_id_vending_machine_id_idx1 on vend_opt_zinvending_default vend_55  (cost=0.27..8.30 rows=1 width=25) (never executed)
"                                                        Index Cond: ((merchant_id = '0bf67c3b-6bc5-4157-bc24-874870ba6c48'::uuid) AND (vending_machine_id = cash_accounting_period.vending_machine_id) AND (""timestamp"" >= cash_accounting_period.created_at) AND (""timestamp"" <= cash_accounting_period.closed_at))"
                                                        Filter: (currency_id = '79d82c87-5d9d-4def-acd3-ba71e70b7688'::uuid)
                                            ->  Aggregate  (cost=1.89..1.91 rows=1 width=32) (actual time=0.006..0.006 rows=1 loops=9518)
"                                                  Filter: (NOT (COALESCE(array_agg(route_vending_machine_2.route_id), '{}'::uuid[]) && '{}'::uuid[]))"
                                                  Buffers: shared hit=9518
                                                  ->  Seq Scan on route_vending_machine route_vending_machine_2  (cost=0.00..1.89 rows=1 width=16) (actual time=0.005..0.005 rows=0 loops=9518)
                                                        Filter: (vending_machine_id = vend_28.vending_machine_id)
                                                        Rows Removed by Filter: 71
                                                        Buffers: shared hit=9518
        ->  Hash  (cost=1.71..1.71 rows=71 width=32) (actual time=0.023..0.024 rows=71 loops=1)
              Buckets: 1024  Batches: 1  Memory Usage: 13kB
              Buffers: shared hit=1
              ->  Seq Scan on route_vending_machine  (cost=0.00..1.71 rows=71 width=32) (actual time=0.003..0.011 rows=71 loops=1)
                    Buffers: shared hit=1
  ->  Memoize  (cost=0.15..0.33 rows=1 width=180) (actual time=0.001..0.001 rows=0 loops=25)
        Cache Key: route_vending_machine.route_id
        Cache Mode: logical
        Hits: 24  Misses: 1  Evictions: 0  Overflows: 0  Memory Usage: 1kB
        ->  Index Scan using route_id_pk on route  (cost=0.14..0.32 rows=1 width=180) (actual time=0.002..0.002 rows=0 loops=1)
              Index Cond: (id = route_vending_machine.route_id)
  SubPlan 1
    ->  Result  (cost=0.00..1.26 rows=1 width=32) (actual time=0.038..0.038 rows=1 loops=25)
Planning:
  Buffers: shared hit=478
Planning Time: 13.687 ms
Execution Time: 1112.523 ms