explain.depesz.com

PostgreSQL's explain analyze made readable

Result: N3tR

Settings
# exclusive inclusive rows x rows loops node
1. 0.093 289.391 ↑ 1.0 500 1

Limit (cost=1.28..66,184.69 rows=500 width=546) (actual time=0.476..289.391 rows=500 loops=1)

2. 15.503 289.298 ↑ 3,191.5 500 1

GroupAggregate (cost=1.28..211,225,129.77 rows=1,595,756 width=546) (actual time=0.476..289.298 rows=500 loops=1)

  • Group Key: m.id
3. 10.228 168.795 ↑ 171.7 14,134 1

Nested Loop Left Join (cost=1.28..1,562,409.24 rows=2,427,220 width=518) (actual time=0.018..168.795 rows=14,134 loops=1)

4. 4.015 130.299 ↑ 171.7 14,134 1

Merge Left Join (cost=0.86..440,214.20 rows=2,427,220 width=491) (actual time=0.010..130.299 rows=14,134 loops=1)

  • Merge Cond: (m.id = mhp.id_movie)
5. 13.809 13.809 ↑ 3,185.1 501 1

Index Scan using movie_pkey on movie m (cost=0.43..253,490.08 rows=1,595,756 width=439) (actual time=0.005..13.809 rows=501 loops=1)

6. 112.475 112.475 ↑ 171.8 14,131 1

Index Scan using movie_has_person_id_movie_idx1 on movie_has_person mhp (cost=0.43..152,394.48 rows=2,427,220 width=60) (actual time=0.003..112.475 rows=14,131 loops=1)

7. 28.268 28.268 ↑ 1.0 1 14,134

Index Scan using person_pkey on person p (cost=0.42..0.46 rows=1 width=43) (actual time=0.002..0.002 rows=1 loops=14,134)

  • Index Cond: (mhp.id_person = id)
8.          

SubPlan (for GroupAggregate)

9. 0.000 15.000 ↑ 1.0 1 500

Limit (cost=6.01..6.02 rows=1 width=32) (actual time=0.030..0.030 rows=1 loops=500)

10. 1.500 15.000 ↑ 1.0 1 500

Aggregate (cost=6.01..6.02 rows=1 width=32) (actual time=0.030..0.030 rows=1 loops=500)

11. 13.500 13.500 ↓ 4.0 4 500

Index Scan using movie_has_release_id_movie_idx on movie_has_release mhr (cost=0.43..6.01 rows=1 width=10) (actual time=0.020..0.027 rows=4 loops=500)

  • Index Cond: (id_movie = m.id)
  • Filter: (((tags)::ltree[] ~ 'Release.Type.Theater'::lquery) AND (NOT ((tags)::ltree[] ~ 'Generic.Flag.NotReleasedYet'::lquery)) AND (NOT ((tags)::ltree[] ~ 'Theater.Flag.Preview'::lquery)) AND (NOT ((tags)::ltree[] ~ 'Theater.Limitation.*'::lquery)))
  • Rows Removed by Filter: 3
12. 2.000 5.000 ↑ 1.0 1 500

Aggregate (cost=5.03..5.04 rows=1 width=32) (actual time=0.010..0.010 rows=1 loops=500)

13. 0.887 3.000 ↑ 1.0 1 500

Nested Loop (cost=0.56..5.02 rows=1 width=9) (actual time=0.005..0.006 rows=1 loops=500)

14. 1.500 1.500 ↑ 1.0 1 500

Index Only Scan using movie_has_country_pkey on movie_has_country mhc (cost=0.42..2.64 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=500)

  • Index Cond: (id_movie = m.id)
  • Heap Fetches: 60
15. 0.613 0.613 ↑ 1.0 1 613

Index Scan using country_pkey on country c (cost=0.14..2.36 rows=1 width=17) (actual time=0.001..0.001 rows=1 loops=613)

  • Index Cond: (id = mhc.id_country)
16. 4.000 38.500 ↑ 1.0 1 500

Aggregate (cost=56.16..56.17 rows=1 width=32) (actual time=0.077..0.077 rows=1 loops=500)

17. 2.240 34.500 ↓ 1.3 26 500

Nested Loop (cost=0.98..55.96 rows=20 width=79) (actual time=0.007..0.069 rows=26 loops=500)

18. 4.000 4.000 ↓ 1.4 28 500

Index Only Scan using movie_has_person_id_movie_id_person_activity_key on movie_has_person mhp_1 (cost=0.56..3.11 rows=20 width=52) (actual time=0.004..0.008 rows=28 loops=500)

  • Index Cond: (id_movie = m.id)
  • Heap Fetches: 0
19. 28.260 28.260 ↑ 1.0 1 14,130

Index Scan using person_pkey on person p_1 (cost=0.42..2.64 rows=1 width=43) (actual time=0.002..0.002 rows=1 loops=14,130)

  • Index Cond: (id = mhp_1.id_person)
20. 10.000 41.000 ↑ 1.0 1 500

Aggregate (cost=56.16..56.17 rows=1 width=32) (actual time=0.082..0.082 rows=1 loops=500)

21. 0.000 31.000 ↓ 1.3 26 500

Nested Loop (cost=0.98..55.96 rows=20 width=79) (actual time=0.005..0.062 rows=26 loops=500)

22. 3.000 3.000 ↓ 1.4 28 500

Index Only Scan using movie_has_person_id_movie_id_person_activity_key on movie_has_person mhp_2 (cost=0.56..3.11 rows=20 width=52) (actual time=0.003..0.006 rows=28 loops=500)

  • Index Cond: (id_movie = m.id)
  • Heap Fetches: 0
23. 28.260 28.260 ↑ 1.0 1 14,130

Index Scan using person_pkey on person p_2 (cost=0.42..2.64 rows=1 width=43) (actual time=0.002..0.002 rows=1 loops=14,130)

  • Index Cond: (id = mhp_2.id_person)
24. 1.500 5.500 ↑ 1.0 1 500

Aggregate (cost=7.69..7.70 rows=1 width=32) (actual time=0.011..0.011 rows=1 loops=500)

25. 1.074 4.000 ↑ 2.0 1 500

Nested Loop (cost=0.71..7.68 rows=2 width=18) (actual time=0.006..0.008 rows=1 loops=500)

26. 1.500 1.500 ↑ 2.0 1 500

Index Only Scan using movie_has_company_pkey on movie_has_company mhc_1 (cost=0.42..2.66 rows=2 width=8) (actual time=0.003..0.003 rows=1 loops=500)

  • Index Cond: (id_movie = m.id)
  • Filter: ((activity)::ltree = ANY ('{Activity.Company.CoProduction,Activity.Company.ExecutiveProducer,Activity.Company.Production}'::ltree[]))
  • Rows Removed by Filter: 0
  • Heap Fetches: 0
27. 1.426 1.426 ↑ 1.0 1 713

Index Scan using company_pkey on company c_1 (cost=0.29..2.51 rows=1 width=26) (actual time=0.002..0.002 rows=1 loops=713)

  • Index Cond: (id = mhc_1.id_company)
Planning time : 2.625 ms
Execution time : 289.629 ms