explain.depesz.com

PostgreSQL's explain analyze made readable

Result: RQHu : Optimization for: plan #bwDT

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 12.642 17,686.257 ↑ 3.8 2,499 1

Unique (cost=1.63..779,505.96 rows=9,426 width=72) (actual time=3.119..17,686.257 rows=2,499 loops=1)

2. 186.811 17,673.615 ↑ 1.0 86,921 1

Nested Loop (cost=1.63..779,280.19 rows=90,309 width=72) (actual time=3.117..17,673.615 rows=86,921 loops=1)

3. 25.049 102.604 ↑ 1.0 86,921 1

Merge Join (cost=1.63..11,877.25 rows=90,309 width=33) (actual time=1.870..102.604 rows=86,921 loops=1)

  • Merge Cond: (a_bk.file_id = a_fl.file_id)
4. 74.022 74.022 ↑ 1.0 86,921 1

Index Only Scan using a on b a_bk (cost=0.42..10,216.13 rows=90,309 width=16) (actual time=0.065..74.022 rows=86,921 loops=1)

  • Index Cond: (session_id = 5)
  • Heap Fetches: 86921
5. 3.533 3.533 ↑ 3.0 4,704 1

Index Scan using d on e a_fl (cost=0.29..500.35 rows=13,986 width=25) (actual time=0.008..3.533 rows=4,704 loops=1)

6. 0.000 0.000 ↑ 1.0 1 86,921

Materialize (cost=0.00..2.22 rows=1 width=8) (actual time=0.000..0.000 rows=1 loops=86,921)

7. 0.094 0.094 ↑ 1.0 1 1

Seq Scan on ff a_ses (cost=0.00..2.21 rows=1 width=8) (actual time=0.088..0.094 rows=1 loops=1)

  • Filter: (session_id = 5)
  • Rows Removed by Filter: 113
8.          

SubPlan (forNested Loop)

9. 10,517.441 17,384.200 ↑ 1.0 1 86,921

Aggregate (cost=8.47..8.48 rows=1 width=32) (actual time=0.200..0.200 rows=1 loops=86,921)

10.          

CTE _

11. 4,346.050 4,346.050 ↓ 62.0 62 86,921

Index Scan using s on e au (cost=0.42..8.44 rows=1 width=104) (actual time=0.009..0.050 rows=62 loops=86,921)

  • Index Cond: ((session_id = a_ses.session_id) AND ((file_name)::text = a_fl.filename))
12. 6,866.759 6,866.759 ↓ 62.0 62 86,921

CTE Scan on _ (cost=0.00..0.02 rows=1 width=24) (actual time=0.010..0.079 rows=62 loops=86,921)