explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4kyZ

Settings
# exclusive inclusive rows x rows loops node
1. 0.424 6.237 ↓ 7.0 7 1

Nested Loop (cost=16.66..34.06 rows=1 width=32) (actual time=6.000..6.237 rows=7 loops=1)

  • Join Filter: (t.account_id = a.id)
  • Rows Removed by Join Filter: 130
2.          

CTE updated_rows

3. 1.892 3.887 ↓ 7.0 7 1

Update on tickets (cost=8.34..16.50 rows=1 width=571) (actual time=3.743..3.887 rows=7 loops=1)

4. 0.417 1.995 ↓ 7.0 7 1

Nested Loop (cost=8.34..16.50 rows=1 width=571) (actual time=1.967..1.995 rows=7 loops=1)

5. 0.012 1.550 ↓ 7.0 7 1

HashAggregate (cost=8.20..8.21 rows=1 width=32) (actual time=1.546..1.550 rows=7 loops=1)

  • Group Key: "ANY_subquery".id
6. 0.012 1.538 ↓ 7.0 7 1

Subquery Scan on ANY_subquery (cost=0.14..8.20 rows=1 width=32) (actual time=1.518..1.538 rows=7 loops=1)

7. 0.002 1.526 ↓ 7.0 7 1

Limit (cost=0.14..8.19 rows=1 width=18) (actual time=1.508..1.526 rows=7 loops=1)

8. 0.915 1.524 ↓ 7.0 7 1

LockRows (cost=0.14..8.19 rows=1 width=18) (actual time=1.507..1.524 rows=7 loops=1)

9. 0.609 0.609 ↓ 7.0 7 1

Index Scan using tickets_confirmation_status_last_check_time_idx on tickets tickets_1 (cost=0.14..8.18 rows=1 width=18) (actual time=0.597..0.609 rows=7 loops=1)

  • Index Cond: (confirmation_status = 'pending'::text)
  • Filter: ((deleted_at IS NULL) AND ((last_check_time)::double precision < (date_part('epoch'::text, CURRENT_TIMESTAMP) - '2'::double precision)))
10. 0.028 0.028 ↑ 1.0 1 7

Index Scan using tickets_pkey on tickets (cost=0.14..8.16 rows=1 width=491) (actual time=0.004..0.004 rows=1 loops=7)

  • Index Cond: (id = "ANY_subquery".id)
11. 0.010 5.715 ↓ 7.0 7 1

Nested Loop Left Join (cost=0.17..6.84 rows=1 width=553) (actual time=5.656..5.715 rows=7 loops=1)

  • Join Filter: (ebd.id = t.external_billing_id)
  • Rows Removed by Join Filter: 14
12. 0.016 5.691 ↓ 7.0 7 1

Nested Loop Left Join (cost=0.17..5.80 rows=1 width=521) (actual time=5.644..5.691 rows=7 loops=1)

  • Join Filter: (p.id = t.payment_method_id)
  • Rows Removed by Join Filter: 21
13. 0.007 5.661 ↓ 7.0 7 1

Nested Loop Left Join (cost=0.17..4.66 rows=1 width=493) (actual time=5.633..5.661 rows=7 loops=1)

14. 0.014 3.960 ↓ 7.0 7 1

Hash Join (cost=0.03..1.15 rows=1 width=465) (actual time=3.951..3.960 rows=7 loops=1)

  • Hash Cond: (d.id = t.device_id)
15. 0.025 0.025 ↓ 2.2 18 1

Seq Scan on devices d (cost=0.00..1.08 rows=8 width=76) (actual time=0.018..0.025 rows=18 loops=1)

16. 0.017 3.921 ↓ 7.0 7 1

Hash (cost=0.02..0.02 rows=1 width=397) (actual time=3.921..3.921 rows=7 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
17. 3.904 3.904 ↓ 7.0 7 1

CTE Scan on updated_rows t (cost=0.00..0.02 rows=1 width=397) (actual time=3.749..3.904 rows=7 loops=1)

18. 1.694 1.694 ↑ 1.0 1 7

Index Scan using pk_device_types_dict on device_types_dict dtd (cost=0.14..3.15 rows=1 width=36) (actual time=0.242..0.242 rows=1 loops=7)

  • Index Cond: (id = d.device_type_id)
19. 0.014 0.014 ↑ 1.5 4 7

Seq Scan on payment_methods_dict p (cost=0.00..1.06 rows=6 width=36) (actual time=0.001..0.002 rows=4 loops=7)

20. 0.014 0.014 ↑ 1.0 2 7

Seq Scan on external_billings_dict ebd (cost=0.00..1.02 rows=2 width=36) (actual time=0.001..0.002 rows=2 loops=7)

21. 0.063 0.063 ↓ 2.5 20 7

Seq Scan on accounts a (cost=0.00..1.08 rows=8 width=152) (actual time=0.003..0.009 rows=20 loops=7)

22.          

SubPlan (for Nested Loop)

23. 0.014 0.035 ↑ 1.0 1 7

Aggregate (cost=9.52..9.53 rows=1 width=32) (actual time=0.005..0.005 rows=1 loops=7)

24. 0.007 0.021 ↓ 0.0 0 7

Bitmap Heap Scan on bank_cards b (cost=4.16..9.50 rows=2 width=211) (actual time=0.003..0.003 rows=0 loops=7)

  • Recheck Cond: (account_id = t.account_id)
25. 0.014 0.014 ↓ 0.0 0 7

Bitmap Index Scan on bank_cards_accounts_id_idx (cost=0.00..4.16 rows=2 width=0) (actual time=0.002..0.002 rows=0 loops=7)

  • Index Cond: (account_id = t.account_id)
Planning time : 1.182 ms