explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 6Bgj

Settings
# exclusive inclusive rows x rows loops node
1. 0.562 9.198 ↑ 3.3 573 1

Unique (cost=728.95..752.50 rows=1,884 width=23) (actual time=8.374..9.198 rows=573 loops=1)

2. 0.983 8.636 ↑ 1.0 1,846 1

Sort (cost=728.95..733.66 rows=1,884 width=23) (actual time=8.373..8.636 rows=1,846 loops=1)

  • Sort Key: r.customer_id, c2.last_name, c2.first_name, (count(r.inventory_id) OVER (?))
  • Sort Method: quicksort Memory: 193kB
3. 1.035 7.653 ↑ 1.0 1,846 1

WindowAgg (cost=593.49..626.46 rows=1,884 width=23) (actual time=6.302..7.653 rows=1,846 loops=1)

4. 1.061 6.618 ↑ 1.0 1,846 1

Sort (cost=593.49..598.20 rows=1,884 width=19) (actual time=6.284..6.618 rows=1,846 loops=1)

  • Sort Key: r.customer_id
  • Sort Method: quicksort Memory: 190kB
5. 0.556 5.557 ↑ 1.0 1,846 1

Hash Join (cost=123.95..491.01 rows=1,884 width=19) (actual time=0.971..5.557 rows=1,846 loops=1)

  • Hash Cond: (r.customer_id = c2.customer_id)
6. 0.687 4.726 ↑ 1.0 1,846 1

Merge Join (cost=101.47..442.62 rows=1,884 width=6) (actual time=0.680..4.726 rows=1,846 loops=1)

  • Merge Cond: (i.inventory_id = f.film_id)
7. 0.884 3.136 ↑ 4.6 3,476 1

Merge Join (cost=0.57..1,393.94 rows=16,044 width=10) (actual time=0.020..3.136 rows=3,476 loops=1)

  • Merge Cond: (i.inventory_id = r.inventory_id)
8. 0.290 0.290 ↑ 4.6 1,001 1

Index Only Scan using inventory_pkey on inventory i (cost=0.28..157.00 rows=4,581 width=4) (actual time=0.013..0.290 rows=1,001 loops=1)

  • Heap Fetches: 1,001
9. 1.962 1.962 ↑ 4.6 3,476 1

Index Scan using idx_fk_inventory_id on rental r (cost=0.29..1,024.94 rows=16,044 width=6) (actual time=0.005..1.962 rows=3,476 loops=1)

10. 0.393 0.903 ↓ 3.4 1,843 1

Sort (cost=100.90..102.25 rows=538 width=4) (actual time=0.652..0.903 rows=1,843 loops=1)

  • Sort Key: f.film_id
  • Sort Method: quicksort Memory: 50kB
11. 0.510 0.510 ↑ 1.0 538 1

Seq Scan on film f (cost=0.00..76.50 rows=538 width=4) (actual time=0.012..0.510 rows=538 loops=1)

  • Filter: ('Behind the Scenes'::text = ANY (special_features))
  • Rows Removed by Filter: 462
12. 0.147 0.275 ↑ 1.0 599 1

Hash (cost=14.99..14.99 rows=599 width=17) (actual time=0.275..0.275 rows=599 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 39kB
13. 0.128 0.128 ↑ 1.0 599 1

Seq Scan on customer c2 (cost=0.00..14.99 rows=599 width=17) (actual time=0.012..0.128 rows=599 loops=1)

Planning time : 1.243 ms
Execution time : 9.434 ms