explain.depesz.com

PostgreSQL's explain analyze made readable

Result: DrO1

Settings
# exclusive inclusive rows x rows loops node
1. 0.007 0.181 ↑ 11.0 1 1

GroupAggregate (cost=75.01..164.81 rows=11 width=292) (actual time=0.181..0.181 rows=1 loops=1)

  • Group Key: "*SELECT* 1".order_id
2. 0.001 0.174 ↑ 3.7 3 1

Merge Append (cost=75.01..163.93 rows=11 width=161) (actual time=0.173..0.174 rows=3 loops=1)

  • Sort Key: "*SELECT* 1".order_id
3. 0.001 0.031 ↑ 2.0 1 1

Subquery Scan on *SELECT* 1 (cost=0.89..25.08 rows=2 width=164) (actual time=0.030..0.031 rows=1 loops=1)

4. 0.004 0.030 ↑ 2.0 1 1

GroupAggregate (cost=0.89..25.06 rows=2 width=228) (actual time=0.030..0.030 rows=1 loops=1)

  • Group Key: ac.order_id
5. 0.000 0.026 ↑ 2.0 1 1

Merge Append (cost=0.89..25.03 rows=2 width=36) (actual time=0.026..0.026 rows=1 loops=1)

  • Sort Key: ac.order_id
6. 0.006 0.017 ↑ 1.0 1 1

GroupAggregate (cost=0.29..8.33 rows=1 width=36) (actual time=0.017..0.017 rows=1 loops=1)

  • Group Key: ac.order_id
7. 0.011 0.011 ↑ 1.0 1 1

Index Scan using attempt_captures_order_id on attempt_captures ac (cost=0.29..8.31 rows=1 width=9) (actual time=0.011..0.011 rows=1 loops=1)

  • Index Cond: (order_id = ANY ('{74313}'::integer[]))
  • Filter: ((NOT is_obsolete) AND was_success)
8. 0.000 0.009 ↓ 0.0 0 1

GroupAggregate (cost=0.58..16.65 rows=1 width=36) (actual time=0.009..0.009 rows=0 loops=1)

  • Group Key: o.id
9. 0.002 0.009 ↓ 0.0 0 1

Nested Loop (cost=0.58..16.63 rows=1 width=9) (actual time=0.009..0.009 rows=0 loops=1)

10. 0.006 0.006 ↑ 1.0 1 1

Index Scan using orders_pkey on orders o (cost=0.29..8.31 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=1)

  • Index Cond: (id = ANY ('{74313}'::integer[]))
11. 0.001 0.001 ↓ 0.0 0 1

Index Scan using attempt_captures_deposit_id on attempt_captures ac_1 (cost=0.29..8.31 rows=1 width=9) (actual time=0.001..0.001 rows=0 loops=1)

  • Index Cond: (deposit_id = o.deposit_applied_id)
  • Filter: ((NOT is_obsolete) AND was_success)
12. 0.000 0.094 ↓ 0.0 0 1

Subquery Scan on *SELECT* 2 (cost=64.68..97.31 rows=4 width=164) (actual time=0.094..0.094 rows=0 loops=1)

13. 0.000 0.094 ↓ 0.0 0 1

GroupAggregate (cost=64.68..97.27 rows=4 width=228) (actual time=0.094..0.094 rows=0 loops=1)

  • Group Key: ar.order_id
14. 0.001 0.094 ↓ 0.0 0 1

Merge Append (cost=64.68..97.20 rows=4 width=36) (actual time=0.094..0.094 rows=0 loops=1)

  • Sort Key: ar.order_id
15. 0.000 0.004 ↓ 0.0 0 1

GroupAggregate (cost=0.56..16.62 rows=1 width=36) (actual time=0.004..0.004 rows=0 loops=1)

  • Group Key: ar.order_id
16. 0.000 0.004 ↓ 0.0 0 1

Nested Loop (cost=0.56..16.60 rows=1 width=10) (actual time=0.004..0.004 rows=0 loops=1)

17. 0.004 0.004 ↓ 0.0 0 1

Index Scan using attempt_refunds_order_id on attempt_refunds ar (cost=0.28..8.29 rows=1 width=14) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: (order_id = ANY ('{74313}'::integer[]))
  • Filter: was_success
18. 0.000 0.000 ↓ 0.0 0

Index Only Scan using refunds_pkey on refunds r (cost=0.28..8.30 rows=1 width=4) (never executed)

  • Index Cond: (id = ar.refund_id)
  • Heap Fetches: 0
19. 0.000 0.071 ↓ 0.0 0 1

GroupAggregate (cost=27.24..27.26 rows=1 width=36) (actual time=0.071..0.071 rows=0 loops=1)

  • Group Key: av.order_id
20. 0.002 0.071 ↓ 0.0 0 1

Sort (cost=27.24..27.24 rows=1 width=10) (actual time=0.071..0.071 rows=0 loops=1)

  • Sort Key: av.order_id
  • Sort Method: quicksort Memory: 25kB
21. 0.001 0.069 ↓ 0.0 0 1

Nested Loop (cost=0.28..27.23 rows=1 width=10) (actual time=0.069..0.069 rows=0 loops=1)

22. 0.068 0.068 ↓ 0.0 0 1

Seq Scan on attempt_voids av (cost=0.00..18.92 rows=1 width=14) (actual time=0.068..0.068 rows=0 loops=1)

  • Filter: (was_success AND (order_id = ANY ('{74313}'::integer[])))
  • Rows Removed by Filter: 171
23. 0.000 0.000 ↓ 0.0 0

Index Only Scan using refunds_pkey on refunds r_1 (cost=0.28..8.30 rows=1 width=4) (never executed)

  • Index Cond: (id = av.refund_id)
  • Heap Fetches: 0
24. 0.000 0.005 ↓ 0.0 0 1

GroupAggregate (cost=0.85..17.16 rows=1 width=36) (actual time=0.005..0.005 rows=0 loops=1)

  • Group Key: o_1.id
25. 0.001 0.005 ↓ 0.0 0 1

Nested Loop (cost=0.85..17.15 rows=1 width=10) (actual time=0.005..0.005 rows=0 loops=1)

26. 0.001 0.004 ↓ 0.0 0 1

Nested Loop (cost=0.57..16.62 rows=1 width=8) (actual time=0.004..0.004 rows=0 loops=1)

27. 0.003 0.003 ↑ 1.0 1 1

Index Scan using orders_pkey on orders o_1 (cost=0.29..8.31 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=1)

  • Index Cond: (id = ANY ('{74313}'::integer[]))
28. 0.000 0.000 ↓ 0.0 0 1

Index Scan using refunds_deposit_id on refunds r_2 (cost=0.28..8.30 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=1)

  • Index Cond: (deposit_id = o_1.deposit_applied_id)
29. 0.000 0.000 ↓ 0.0 0

Index Scan using attempt_refunds_refund_id on attempt_refunds ar_1 (cost=0.28..0.52 rows=1 width=10) (never executed)

  • Index Cond: (refund_id = r_2.id)
  • Filter: was_success
30. 0.000 0.013 ↓ 0.0 0 1

GroupAggregate (cost=35.99..36.02 rows=1 width=36) (actual time=0.013..0.013 rows=0 loops=1)

  • Group Key: o_2.id
31. 0.001 0.013 ↓ 0.0 0 1

Sort (cost=35.99..36.00 rows=1 width=10) (actual time=0.013..0.013 rows=0 loops=1)

  • Sort Key: o_2.id
  • Sort Method: quicksort Memory: 25kB
32. 0.005 0.012 ↓ 0.0 0 1

Hash Join (cost=16.63..35.98 rows=1 width=10) (actual time=0.012..0.012 rows=0 loops=1)

  • Hash Cond: (av_1.refund_id = r_3.id)
33. 0.001 0.001 ↑ 169.0 1 1

Seq Scan on attempt_voids av_1 (cost=0.00..18.71 rows=169 width=10) (actual time=0.001..0.001 rows=1 loops=1)

  • Filter: was_success
34. 0.000 0.006 ↓ 0.0 0 1

Hash (cost=16.62..16.62 rows=1 width=8) (actual time=0.006..0.006 rows=0 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
35. 0.001 0.006 ↓ 0.0 0 1

Nested Loop (cost=0.57..16.62 rows=1 width=8) (actual time=0.006..0.006 rows=0 loops=1)

36. 0.003 0.003 ↑ 1.0 1 1

Index Scan using orders_pkey on orders o_2 (cost=0.29..8.31 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=1)

  • Index Cond: (id = ANY ('{74313}'::integer[]))
37. 0.002 0.002 ↓ 0.0 0 1

Index Scan using refunds_deposit_id on refunds r_3 (cost=0.28..8.30 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=1)

  • Index Cond: (deposit_id = o_2.deposit_applied_id)
38. 0.000 0.022 ↑ 1.0 1 1

Subquery Scan on *SELECT* 3 (cost=0.71..24.43 rows=1 width=164) (actual time=0.022..0.022 rows=1 loops=1)

39. 0.002 0.022 ↑ 1.0 1 1

GroupAggregate (cost=0.71..24.42 rows=1 width=228) (actual time=0.022..0.022 rows=1 loops=1)

  • Group Key: i.order_id
40. 0.009 0.020 ↑ 1.0 1 1

GroupAggregate (cost=0.71..24.40 rows=1 width=36) (actual time=0.019..0.020 rows=1 loops=1)

  • Group Key: i.order_id
41. 0.003 0.011 ↑ 1.0 2 1

Nested Loop (cost=0.71..24.33 rows=2 width=19) (actual time=0.010..0.011 rows=2 loops=1)

42. 0.005 0.005 ↑ 1.0 1 1

Index Scan using invoices_order_id on invoices i (cost=0.29..8.31 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=1)

  • Index Cond: (order_id = ANY ('{74313}'::integer[]))
43. 0.003 0.003 ↑ 1.5 2 1

Index Scan using invoice_items_invoice_id on invoice_items ii (cost=0.42..15.99 rows=3 width=19) (actual time=0.003..0.003 rows=2 loops=1)

  • Index Cond: (invoice_id = i.id)
44. 0.005 0.010 ↑ 1.0 1 1

Sort (cost=8.33..8.34 rows=1 width=135) (actual time=0.010..0.010 rows=1 loops=1)

  • Sort Key: "*SELECT* 4".order_id
  • Sort Method: quicksort Memory: 25kB
45. 0.000 0.005 ↑ 1.0 1 1

Subquery Scan on *SELECT* 4 (cost=0.29..8.32 rows=1 width=135) (actual time=0.005..0.005 rows=1 loops=1)

46. 0.005 0.005 ↑ 1.0 1 1

Index Scan using orders_pkey on orders o_3 (cost=0.29..8.31 rows=1 width=199) (actual time=0.005..0.005 rows=1 loops=1)

  • Index Cond: (id = ANY ('{74313}'::integer[]))
47. 0.000 0.006 ↓ 0.0 0 1

Subquery Scan on *SELECT* 5 (cost=0.01..0.06 rows=1 width=164) (actual time=0.006..0.006 rows=0 loops=1)

48. 0.001 0.006 ↓ 0.0 0 1

GroupAggregate (cost=0.01..0.05 rows=1 width=228) (actual time=0.006..0.006 rows=0 loops=1)

  • Group Key: order_id
49. 0.000 0.005 ↓ 0.0 0 1

GroupAggregate (cost=0.01..0.03 rows=1 width=36) (actual time=0.005..0.005 rows=0 loops=1)

  • Group Key: order_id
50. 0.004 0.005 ↓ 0.0 0 1

Sort (cost=0.01..0.02 rows=0 width=4) (actual time=0.005..0.005 rows=0 loops=1)

  • Sort Key: order_id
  • Sort Method: quicksort Memory: 25kB
51. 0.001 0.001 ↓ 0.0 0 1

Result (cost=0.00..0.00 rows=0 width=4) (actual time=0.001..0.001 rows=0 loops=1)

  • One-Time Filter: false
52. 0.000 0.005 ↓ 0.0 0 1

Subquery Scan on *SELECT* 6 (cost=0.28..8.35 rows=1 width=164) (actual time=0.005..0.005 rows=0 loops=1)

53. 0.000 0.005 ↓ 0.0 0 1

GroupAggregate (cost=0.28..8.34 rows=1 width=228) (actual time=0.005..0.005 rows=0 loops=1)

  • Group Key: r_4.order_id
54. 0.000 0.005 ↓ 0.0 0 1

GroupAggregate (cost=0.28..8.31 rows=1 width=36) (actual time=0.005..0.005 rows=0 loops=1)

  • Group Key: r_4.order_id
55. 0.005 0.005 ↓ 0.0 0 1

Index Scan using refunds_order_id on refunds r_4 (cost=0.28..8.30 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=1)

  • Index Cond: (order_id = ANY ('{74313}'::integer[]))
56. 0.000 0.005 ↓ 0.0 0 1

Subquery Scan on *SELECT* 7 (cost=0.01..0.06 rows=1 width=164) (actual time=0.005..0.005 rows=0 loops=1)

57. 0.001 0.005 ↓ 0.0 0 1

GroupAggregate (cost=0.01..0.05 rows=1 width=228) (actual time=0.004..0.005 rows=0 loops=1)

  • Group Key: order_id
58. 0.000 0.004 ↓ 0.0 0 1

GroupAggregate (cost=0.01..0.03 rows=1 width=36) (actual time=0.004..0.004 rows=0 loops=1)

  • Group Key: order_id
59. 0.004 0.004 ↓ 0.0 0 1

Sort (cost=0.01..0.02 rows=0 width=0) (actual time=0.004..0.004 rows=0 loops=1)

  • Sort Key: order_id
  • Sort Method: quicksort Memory: 25kB
60. 0.000 0.000 ↓ 0.0 0 1

Result (cost=0.00..0.00 rows=0 width=0) (actual time=0.000..0.000 rows=0 loops=1)

  • One-Time Filter: false