explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1Raw

Settings
# exclusive inclusive rows x rows loops node
1. 8.354 8.362 ↓ 0.0 18 1

'-> Sort: <temporary>.no_films_to_rent DESC (cost=0..0 rows=0 width=0) (actual time=8.358..8.362 rows=18 loops=1)

2. 0.000 0.008 ↓ 0.0 18 1

Table scan on <temporary> (cost=0..0 rows=0 width=0) (actual time=0.002..0.008 rows=18 loops=1)

3. 1.581 8.334 ↓ 0.0 18 1

Aggregate using temporary table (cost=0..0 rows=0 width=0) (actual time=8.327..8.334 rows=18 loops=1)

4. 0.022 6.753 ↓ 0.0 56 1

Nested loop inner join (cost=2.02 rows=0) (cost=0..0 rows=0 width=0) (actual time=2.097..6.753 rows=56 loops=1)

5. 0.050 4.715 ↓ 0.0 56 1

Nested loop inner join (cost=1.95 rows=0) (cost=0..0 rows=0 width=0) (actual time=0.105..4.715 rows=56 loops=1)

6. 0.010 4.609 ↓ 0.0 56 1

Nested loop inner join (cost=1.85 rows=0) (cost=0..0 rows=0 width=0) (actual time=0.097..4.609 rows=56 loops=1)

7. 0.004 0.049 ↓ 0.0 2 1

Nested loop inner join (cost=1.15 rows=2) (cost=0..0 rows=0 width=0) (actual time=0.037..0.049 rows=2 loops=1)

8. 0.023 0.023 ↓ 0.0 2 1

Index scan on TS using idx_unique_manager (cost=0.45 rows=2) (cost=0..0 rows=0 width=0) (actual time=0.021..0.023 rows=2 loops=1)

9. 0.002 0.022 ↓ 0.0 1 2

Filter: (ts.store_id = ta.address_id) (cost=0.30 rows=1) (cost=0..0 rows=0 width=0) (actual time=0.011..0.011 rows=1 loops=2)

10. 0.020 0.020 ↓ 0.0 1 2

Single-row index lookup on TA using PRIMARY (address_id=ts.store_id) (cost=0.30 rows=1) (cost=0..0 rows=0 width=0) (actual time=0.010..0.010 rows=1 loops=2)

11. 1.868 4.550 ↓ 0.0 28 2

Filter: ((ti.store_id = ts.store_id) and (ti.film_id between 10 and 20)) (cost=0.25 rows=0) (cost=0..0 rows=0 width=0) (actual time=0.051..2.275 rows=28 loops=2)

12. 2.682 2.682 ↓ 0.0 2,290 2

Index lookup on TI using idx_store_id_film_id (store_id=ta.address_id) (cost=0.25 rows=1) (cost=0..0 rows=0 width=0) (actual time=0.028..1.341 rows=2,290 loops=2)

13. 0.056 0.056 ↓ 0.0 1 56

Single-row index lookup on TF using PRIMARY (film_id=ti.film_id) (cost=1.86 rows=1) (cost=0..0 rows=0 width=0) (actual time=0.001..0.001 rows=1 loops=56)

14. 2.016 2.016 ↓ 0.0 1 56

Single-row index lookup on TC using PRIMARY (city_id=ta.city_id) (cost=1.62 rows=1) (cost=0..0 rows=0 width=0) (actual time=0.036..0.036 rows=1 loops=56)