explain.depesz.com

PostgreSQL's explain analyze made readable

Result: C2if

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 41.292 ↓ 0.0 0 1

GroupAggregate (cost=78.94..79.01 rows=1 width=176) (actual time=41.292..41.292 rows=0 loops=1)

  • Group Key: directives.id
2. 0.005 41.290 ↓ 0.0 0 1

Sort (cost=78.94..78.94 rows=1 width=56) (actual time=41.290..41.290 rows=0 loops=1)

  • Sort Key: directives.id
  • Sort Method: quicksort Memory: 25kB
3. 2.343 41.285 ↓ 0.0 0 1

Hash Join (cost=5.36..78.93 rows=1 width=56) (actual time=41.284..41.285 rows=0 loops=1)

  • Hash Cond: (dir_mtl.media_type_id = dir_cmt.media_type_id)
  • Join Filter: (NOT (SubPlan 1))
  • Rows Removed by Join Filter: 1827
4. 1.107 2.375 ↓ 1,827.0 1,827 1

Nested Loop (cost=4.24..72.58 rows=1 width=76) (actual time=0.102..2.375 rows=1,827 loops=1)

5. 0.017 0.116 ↓ 9.0 9 1

Nested Loop (cost=0.43..60.34 rows=1 width=72) (actual time=0.039..0.116 rows=9 loops=1)

6. 0.027 0.027 ↓ 1.1 8 1

Seq Scan on directives (cost=0.00..1.14 rows=7 width=68) (actual time=0.013..0.027 rows=8 loops=1)

  • Filter: (NOT soft_deleted)
  • Rows Removed by Filter: 10
7. 0.072 0.072 ↑ 1.0 1 8

Index Only Scan using idx_uniq_links_media_types on links_media_types dir_mtl (cost=0.43..8.45 rows=1 width=8) (actual time=0.007..0.009 rows=1 loops=8)

  • Index Cond: ((media_type_linked_id = directives.id) AND (media_type_linked_type = 'Directive'::text))
  • Heap Fetches: 9
8. 0.954 1.152 ↓ 14.5 203 9

Bitmap Heap Scan on territories_countries dir_tc (cost=3.82..12.09 rows=14 width=8) (actual time=0.031..0.128 rows=203 loops=9)

  • Recheck Cond: (territory_id = directives.license_origin_id)
  • Heap Blocks: exact=144
9. 0.198 0.198 ↓ 14.5 203 9

Bitmap Index Scan on index_territories_countries_on_territory_id_and_country_id (cost=0.00..3.81 rows=14 width=0) (actual time=0.022..0.022 rows=203 loops=9)

  • Index Cond: (territory_id = directives.license_origin_id)
10. 0.007 0.027 ↑ 1.0 5 1

Hash (cost=1.05..1.05 rows=5 width=8) (actual time=0.026..0.027 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
11. 0.020 0.020 ↑ 1.0 5 1

Seq Scan on media_types_with_contained_media_types dir_cmt (cost=0.00..1.05 rows=5 width=8) (actual time=0.016..0.020 rows=5 loops=1)

12.          

SubPlan (for Hash Join)

13. 1.827 36.540 ↑ 17.0 1 1,827

Nested Loop (cost=1.13..70.75 rows=17 width=0) (actual time=0.020..0.020 rows=1 loops=1,827)

14. 7.308 7.308 ↑ 17.0 1 1,827

Index Only Scan using index_territories_countries_on_country_id_and_territory_id on territories_countries d_tc (cost=0.28..52.57 rows=17 width=0) (actual time=0.004..0.004 rows=1 loops=1,827)

  • Index Cond: (country_id = dir_tc.country_id)
  • Heap Fetches: 1827
15. 1.827 27.405 ↑ 1.0 1 1,827

Materialize (cost=0.85..17.98 rows=1 width=0) (actual time=0.015..0.015 rows=1 loops=1,827)

16. 7.308 25.578 ↑ 1.0 1 1,827

Nested Loop (cost=0.85..17.97 rows=1 width=0) (actual time=0.014..0.014 rows=1 loops=1,827)

17. 1.827 1.827 ↑ 1.0 1 1,827

Seq Scan on media_types_with_contained_media_types d_cmt (cost=0.00..1.06 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1,827)

  • Filter: (contained_media_type_id = dir_cmt.contained_media_type_id)
  • Rows Removed by Filter: 0
18. 1.827 16.443 ↑ 1.0 1 1,827

Nested Loop (cost=0.85..16.90 rows=1 width=4) (actual time=0.009..0.009 rows=1 loops=1,827)

19. 7.308 7.308 ↑ 1.0 1 1,827

Index Scan using deals_by_dealable_pair_nd on deals d (cost=0.42..8.44 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=1,827)

  • Index Cond: (dealable_pair_id = directives.dealable_pair_id)
  • Filter: ((NOT disabled_by_editor) AND (dir_tc.territory_id = share_territory_id))
20. 7.308 7.308 ↑ 1.0 1 1,827

Index Only Scan using idx_uniq_links_media_types on links_media_types d_mtl (cost=0.43..8.45 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=1,827)

  • Index Cond: ((media_type_linked_id = d.id) AND (media_type_linked_type = 'Deal'::text) AND (media_type_id = d_cmt.media_type_id))
  • Heap Fetches: 1827
Planning time : 3.864 ms
Execution time : 41.487 ms