explain.depesz.com

PostgreSQL's explain analyze made readable

Result: dOM9I

Settings
# exclusive inclusive rows x rows loops node
1. 0.018 0.205 ↓ 1.2 7 1

Sort (cost=89.41..89.42 rows=6 width=86) (actual time=0.205..0.205 rows=7 loops=1)

  • Sort Key: cs.external_id, cs.activation_number, cmr.date, cmr_with_end_date.end_date
  • Sort Method: quicksort Memory: 25kB
2.          

CTE cmr_with_prev

3. 0.029 0.054 ↑ 1.0 13 1

WindowAgg (cost=32.28..32.70 rows=13 width=67) (actual time=0.030..0.054 rows=13 loops=1)

4. 0.010 0.025 ↑ 1.0 13 1

Sort (cost=32.28..32.31 rows=13 width=50) (actual time=0.025..0.025 rows=13 loops=1)

  • Sort Key: cmr_1.customer_subscription_id, cmr_1.date, cmr_1.created_at
  • Sort Method: quicksort Memory: 26kB
5. 0.009 0.015 ↑ 1.0 13 1

Bitmap Heap Scan on customer_mrr_readings cmr_1 (cost=4.38..32.04 rows=13 width=50) (actual time=0.010..0.015 rows=13 loops=1)

  • Recheck Cond: (customer_id = 14)
  • Heap Blocks: exact=1
6. 0.006 0.006 ↑ 1.0 13 1

Bitmap Index Scan on index_customer_mrr_readings_on_customer_id_and_date (cost=0.00..4.38 rows=13 width=0) (actual time=0.006..0.006 rows=13 loops=1)

  • Index Cond: (customer_id = 14)
7.          

CTE cmr_with_is_change

8. 0.073 0.073 ↑ 1.0 13 1

CTE Scan on cmr_with_prev (cost=0.00..0.39 rows=13 width=94) (actual time=0.034..0.073 rows=13 loops=1)

9.          

CTE cmr_with_end_date

10. 0.011 0.104 ↓ 1.2 7 1

WindowAgg (cost=0.34..0.47 rows=6 width=102) (actual time=0.095..0.104 rows=7 loops=1)

11. 0.006 0.093 ↓ 1.2 7 1

Sort (cost=0.34..0.35 rows=6 width=94) (actual time=0.092..0.093 rows=7 loops=1)

  • Sort Key: cmr_with_is_change.customer_subscription_id, cmr_with_is_change.date, cmr_with_is_change.created_at
  • Sort Method: quicksort Memory: 25kB
12. 0.087 0.087 ↓ 1.2 7 1

CTE Scan on cmr_with_is_change (cost=0.00..0.26 rows=6 width=94) (actual time=0.035..0.087 rows=7 loops=1)

  • Filter: is_change
  • Rows Removed by Filter: 6
13. 0.006 0.187 ↓ 1.2 7 1

Nested Loop (cost=0.85..55.77 rows=6 width=86) (actual time=0.113..0.187 rows=7 loops=1)

14. 0.004 0.174 ↓ 1.2 7 1

Nested Loop (cost=0.71..54.69 rows=6 width=86) (actual time=0.110..0.174 rows=7 loops=1)

15. 0.004 0.163 ↓ 1.2 7 1

Nested Loop (cost=0.56..53.63 rows=6 width=74) (actual time=0.108..0.163 rows=7 loops=1)

16. 0.006 0.145 ↓ 1.2 7 1

Nested Loop (cost=0.42..51.04 rows=6 width=62) (actual time=0.105..0.145 rows=7 loops=1)

17. 0.006 0.132 ↓ 1.2 7 1

Nested Loop (cost=0.28..49.97 rows=6 width=37) (actual time=0.102..0.132 rows=7 loops=1)

18. 0.112 0.112 ↓ 1.2 7 1

CTE Scan on cmr_with_end_date (cost=0.00..0.12 rows=6 width=13) (actual time=0.097..0.112 rows=7 loops=1)

19. 0.014 0.014 ↑ 1.0 1 7

Index Scan using customer_mrr_readings_pkey on customer_mrr_readings cmr (cost=0.28..8.30 rows=1 width=32) (actual time=0.002..0.002 rows=1 loops=7)

  • Index Cond: (id = cmr_with_end_date.id)
20. 0.007 0.007 ↑ 1.0 1 7

Index Scan using customer_subscriptions_pkey on customer_subscriptions cs (cost=0.14..0.17 rows=1 width=33) (actual time=0.001..0.001 rows=1 loops=7)

  • Index Cond: (id = cmr.customer_subscription_id)
21. 0.014 0.014 ↑ 1.0 1 7

Index Scan using customers_pkey on customers c (cost=0.14..0.42 rows=1 width=20) (actual time=0.001..0.002 rows=1 loops=7)

  • Index Cond: (id = cs.customer_id)
22. 0.007 0.007 ↑ 1.0 1 7

Index Scan using plans_pkey on plans (cost=0.14..0.17 rows=1 width=20) (actual time=0.001..0.001 rows=1 loops=7)

  • Index Cond: (id = cmr.plan_id)
23. 0.007 0.007 ↑ 1.0 1 7

Index Scan using currencies_pkey on currencies (cost=0.14..0.17 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=7)

  • Index Cond: (id = cmr.currency_id)