explain.depesz.com

PostgreSQL's explain analyze made readable

Result: dgrU

Settings
# exclusive inclusive rows x rows loops node
1. 0.022 0.180 ↓ 1.2 7 1

Sort (cost=89.53..89.54 rows=6 width=125) (actual time=0.180..0.180 rows=7 loops=1)

  • Sort Key: mrr_intervals.subscription_external_id, mrr_intervals.subscription_activation_number, mrr_intervals.start_date, mrr_intervals.end_date
  • Sort Method: quicksort Memory: 25kB
2.          

CTE cmr_with_prev

3. 0.022 0.051 ↑ 1.0 13 1

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

4. 0.016 0.029 ↑ 1.0 13 1

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

  • Sort Key: cmr.customer_subscription_id, cmr.date, cmr.created_at
  • Sort Method: quicksort Memory: 26kB
5. 0.008 0.013 ↑ 1.0 13 1

Bitmap Heap Scan on customer_mrr_readings cmr (cost=4.38..32.04 rows=13 width=50) (actual time=0.009..0.013 rows=13 loops=1)

  • Recheck Cond: (customer_id = 14)
  • Heap Blocks: exact=1
6. 0.005 0.005 ↑ 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.005..0.005 rows=13 loops=1)

  • Index Cond: (customer_id = 14)
7.          

CTE cmr_with_is_change

8. 0.063 0.063 ↑ 1.0 13 1

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

9.          

CTE cmr_with_end_date

10. 0.007 0.092 ↓ 1.2 7 1

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

11. 0.014 0.085 ↓ 1.2 7 1

Sort (cost=0.34..0.35 rows=6 width=94) (actual time=0.084..0.085 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.071 0.071 ↓ 1.2 7 1

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

  • Filter: is_change
  • Rows Removed by Filter: 6
13.          

CTE mrr_intervals

14. 0.002 0.153 ↓ 1.2 7 1

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

15. 0.002 0.144 ↓ 1.2 7 1

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

16. 0.001 0.135 ↓ 1.2 7 1

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

17. 0.006 0.127 ↓ 1.2 7 1

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

18. 0.009 0.114 ↓ 1.2 7 1

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

19. 0.098 0.098 ↓ 1.2 7 1

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

20. 0.007 0.007 ↑ 1.0 1 7

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

  • Index Cond: (id = cmr_with_end_date.id)
21. 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_1.customer_subscription_id)
22. 0.007 0.007 ↑ 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.001 rows=1 loops=7)

  • Index Cond: (id = cs.customer_id)
23. 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_1.plan_id)
24. 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_1.currency_id)
25. 0.158 0.158 ↓ 1.2 7 1

CTE Scan on mrr_intervals (cost=0.00..0.12 rows=6 width=125) (actual time=0.103..0.158 rows=7 loops=1)