explain.depesz.com

PostgreSQL's explain analyze made readable

Result: YbW

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 2,388.471 ↑ 47,864.0 1 1

Unique (cost=2,858,307.87..2,876,376.53 rows=47,864 width=13,775) (actual time=2,388.47..2,388.471 rows=1 loops=1)

  • Buffers: shared hit=1,564,624
2. 0.076 2,388.468 ↑ 47,864.0 1 1

Sort (cost=2,858,307.87..2,858,427.53 rows=47,864 width=13,775) (actual time=2,388.467..2,388.468 rows=1 loops=1)

  • Sort Key: cards_order.id, cards_order.uid, cards_order.status, cards_order.created_at, cards_order.updated_at, cards_order.customer_id, cards_order.channel, cards_order.ip_address, cards_order.user_agent, cards_order.number, cards_order.created_by_id, cards_order.deliver_as_org, cards_order.client_reference, cards_order.history, cards_order.gift_requires_prezzee_account, cards_order.invoice_id, cards_order.gift_expires_at, cards_order.approved, cards_order.guest_email, cards_order.guest_name, cards_order.guest_phone, cards_order.postpaid, cards_order.completed_at, cards_order.total, cards_order.device_id, cards_order.forter_token, cards_order.desired_status, cards_order.promo_code_id, cards_order.total_currency, cards_order.intended_payment_type, cards_order.type, cards_order.crm_id, customers_customer.id, customers_customer.password, customers_customer.last_login, customers_customer.is_superuser, customers_customer.uid, customers_customer.email, customers_customer.first_name, customers_customer.last_name, customers_customer.phone, customers_customer.is_staff, customers_customer.is_active, customers_customer.date_joined, customers_customer.stripe_customer_id, customers_customer.created_at, customers_customer.updated_at, customers_customer.marketing_optin, customers_customer.ip_addresses, customers_customer.mfa_required, customers_customer.account_limits, customers_customer.organisation_id, customers_customer.type, customers_customer.email_validated, customers_customer.telesign_score, customers_customer.deleted_at, customers_customer.ip_whitelist, customers_customer.crm_id, t3.id, t3.password, t3.last_login, t3.is_superuser, t3.uid, t3.email, t3.first_name, t3.last_name, t3.phone, t3.is_staff, t3.is_active, t3.date_joined, t3.stripe_customer_id, t3.created_at, t3.updated_at, t3.marketing_optin, t3.ip_addresses, t3.mfa_required, t3.account_limits, t3.organisation_id, t3.type, t3.email_validated, t3.telesign_score, t3.deleted_at, t3.ip_whitelist, t3.crm_id, billing_invoice.id, billing_invoice.uid, billing_invoice.number, billing_invoice.type, billing_invoice.status, billing_invoice.template, billing_invoice.subtotal, billing_invoice.total, billing_invoice.pdf, billing_invoice.history, billing_invoice.created_at, billing_invoice.updated_at, billing_invoice.customer_id, billing_invoice.xero_uid, billing_invoice.paid_at, billing_invoice.payment_id, billing_invoice.consolidated, billing_invoice.notes, billing_invoice.billed_to, billing_invoice.subtotal_currency, billing_invoice.total_currency, billing_payment.id, billing_payment.uid, billing_payment.type, billing_payment.status, billing_payment.amount, billing_payment.stripe_charge_id, billing_payment.stripe_fee, billing_payment.stripe_fee_gst, billing_payment.stripe_card_last4, billing_payment.stripe_card_brand, billing_payment.created_at, billing_payment.customer_id, billing_payment.verification_code, billing_payment.history, billing_payment.stripe_card_fingerprint, billing_payment.verification_status, billing_payment.stripe_token, billing_payment.payout_invoice_id, billing_payment.refund_payout_invoice_id, billing_payment.stripe_customer_id, billing_payment.stripe_source_id, billing_payment.stripe_error_code, billing_payment.stripe_error_decline_code, billing_payment.stripe_error_message, billing_payment.stripe_error_param, billing_payment.stripe_error_type, billing_payment.stripe_card_tokenization_method, billing_payment.authorised_at, billing_payment.received_at, billing_payment.refunded_at, billing_payment.updated_at, billing_payment.bank_payment_description, billing_payment.stripe_risk_level, billing_payment.risk_decision, billing_payment.risk_reason, billing_payment.stripe_card_country, billing_payment.stripe_card_cvc_check, billing_payment.stripe_card_expiry_month, billing_payment.stripe_card_expiry_year, billing_payment.stripe_card_funding, billing_payment.amount_currency, billing_payment.prezzee_payment_card_id, billing_payment.prezzee_payment_transaction_id, billing_payment.stripe_fee_currency, billing_payment.stripe_fee_gst_currency
  • Sort Method: quicksort Memory: 29kB
  • Buffers: shared hit=1,564,624
3. 0.000 2,388.392 ↑ 47,864.0 1 1

Append (cost=1,001.7..2,572,378.75 rows=47,864 width=13,775) (actual time=2,155.587..2,388.392 rows=1 loops=1)

  • Buffers: shared hit=1,564,624
4. 4.371 1,000.549 ↓ 0.0 0 1

Gather (cost=1,001.7..806,212.2 rows=15,950 width=4,081) (actual time=1,000.439..1,000.549 rows=0 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
  • Buffers: shared hit=695,781
5. 0.001 996.178 ↓ 0.0 0 3 / 3

Nested Loop (cost=1.7..803,617.2 rows=6,646 width=4,081) (actual time=996.178..996.178 rows=0 loops=3)

  • Buffers: shared hit=695,781
6. 0.001 996.177 ↓ 0.0 0 3 / 3

Nested Loop (cost=1.27..799,718.02 rows=6,646 width=3,471) (actual time=996.177..996.177 rows=0 loops=3)

  • Buffers: shared hit=695,781
7. 0.001 996.176 ↓ 0.0 0 3 / 3

Nested Loop (cost=0.84..752,931.17 rows=6,646 width=3,074) (actual time=996.176..996.176 rows=0 loops=3)

  • Buffers: shared hit=695,781
8. 0.002 996.175 ↓ 0.0 0 3 / 3

Nested Loop (cost=0.42..734,324.81 rows=6,646 width=2,274) (actual time=996.175..996.175 rows=0 loops=3)

  • Buffers: shared hit=695,781
9. 996.173 996.173 ↓ 0.0 0 3 / 3

Seq Scan on cards_order cards_order (cost=0..715,718.46 rows=6,646 width=1,474) (actual time=996.173..996.173 rows=0 loops=3)

  • Filter: (upper((cards_order.uid)::text) ~~ 'A'::text)
  • Buffers: shared hit=695,781
10. 0.000 0.000 ↓ 0.0 0 0 / 3

Index Scan using customers_customer_pkey on customers_customer customers_customer (cost=0.42..2.8 rows=1 width=800) (never executed)

  • Index Cond: (cards_order.created_by_id = customers_customer.id)
11. 0.000 0.000 ↓ 0.0 0 0 / 3

Index Scan using customers_customer_pkey on customers_customer t3 (cost=0.42..2.8 rows=1 width=800) (never executed)

  • Index Cond: (cards_order.customer_id = t3.id)
12. 0.000 0.000 ↓ 0.0 0 0 / 3

Index Scan using billing_invoice_pkey on billing_invoice billing_invoice (cost=0.43..7.04 rows=1 width=397) (never executed)

  • Index Cond: (cards_order.invoice_id = billing_invoice.id)
13. 0.000 0.000 ↓ 0.0 0 0 / 3

Index Scan using billing_payment_pkey on billing_payment billing_payment (cost=0.43..0.59 rows=1 width=610) (never executed)

  • Index Cond: (billing_invoice.payment_id = billing_payment.id)
14. 0.002 0.023 ↓ 0.0 0 1

Nested Loop (cost=2.13..2,947.99 rows=14 width=4,081) (actual time=0.022..0.023 rows=0 loops=1)

  • Buffers: shared hit=3
15. 0.001 0.021 ↓ 0.0 0 1

Nested Loop (cost=1.7..2,939.78 rows=14 width=3,471) (actual time=0.021..0.021 rows=0 loops=1)

  • Buffers: shared hit=3
16. 0.000 0.020 ↓ 0.0 0 1

Nested Loop (cost=1.27..2,930.16 rows=14 width=3,074) (actual time=0.02..0.02 rows=0 loops=1)

  • Buffers: shared hit=3
17. 0.001 0.020 ↓ 0.0 0 1

Nested Loop (cost=0.85..2,923.86 rows=14 width=2,274) (actual time=0.019..0.02 rows=0 loops=1)

  • Buffers: shared hit=3
18. 0.019 0.019 ↓ 0.0 0 1

Index Scan using email_index on customers_customer t3_1 (cost=0.42..8.44 rows=1 width=800) (actual time=0.019..0.019 rows=0 loops=1)

  • Index Cond: (upper((t3_1.email)::text) = 'A'::text)
  • Filter: (upper((t3_1.email)::text) ~~ 'A'::text)
  • Buffers: shared hit=3
19. 0.000 0.000 ↓ 0.0 0 0

Index Scan using cards_order_customer_id_fc9a0bb9 on cards_order cards_order_1 (cost=0.43..2,905.47 rows=994 width=1,474) (never executed)

  • Index Cond: (cards_order_1.customer_id = t3_1.id)
20. 0.000 0.000 ↓ 0.0 0 0

Index Scan using customers_customer_pkey on customers_customer customers_customer_1 (cost=0.42..0.45 rows=1 width=800) (never executed)

  • Index Cond: (cards_order_1.created_by_id = customers_customer_1.id)
21. 0.000 0.000 ↓ 0.0 0 0

Index Scan using billing_invoice_pkey on billing_invoice billing_invoice_1 (cost=0.43..0.69 rows=1 width=397) (never executed)

  • Index Cond: (cards_order_1.invoice_id = billing_invoice_1.id)
22. 0.000 0.000 ↓ 0.0 0 0

Index Scan using billing_payment_pkey on billing_payment billing_payment_1 (cost=0.43..0.59 rows=1 width=610) (never executed)

  • Index Cond: (billing_invoice_1.payment_id = billing_payment_1.id)
23. 5.070 538.903 ↓ 0.0 0 1

Gather (cost=193,908.06..956,288.4 rows=15,950 width=4,081) (actual time=538.691..538.903 rows=0 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
  • Buffers: shared hit=173,043
24. 0.001 533.833 ↓ 0.0 0 3 / 3

Nested Loop (cost=192,908.06..953,693.4 rows=6,646 width=4,081) (actual time=533.833..533.833 rows=0 loops=3)

  • Buffers: shared hit=173,043
25. 0.001 533.832 ↓ 0.0 0 3 / 3

Nested Loop (cost=192,907.63..911,453.06 rows=6,646 width=3,471) (actual time=533.832..533.832 rows=0 loops=3)

  • Buffers: shared hit=173,043
26. 0.000 533.831 ↓ 0.0 0 3 / 3

Nested Loop (cost=192,907.21..908,460.77 rows=6,646 width=2,671) (actual time=533.831..533.831 rows=0 loops=3)

  • Buffers: shared hit=173,043
27. 0.126 533.832 ↓ 0.0 0 3 / 3

Hash Join (cost=192,906.79..905,468.48 rows=6,646 width=1,871) (actual time=533.83..533.832 rows=0 loops=3)

  • Buffers: shared hit=173,043
28. 0.000 0.000 ↓ 0.0 0 0 / 3

Seq Scan on cards_order cards_order_2 (cost=0..709,072.64 rows=1,329,164 width=1,474) (never executed)

29. 0.023 533.706 ↓ 0.0 0 3 / 3

Hash (cost=192,824.14..192,824.14 rows=6,612 width=397) (actual time=533.706..533.706 rows=0 loops=3)

  • Buffers: shared hit=172,987
30. 533.683 533.683 ↓ 0.0 0 3 / 3

Seq Scan on billing_invoice billing_invoice_2 (cost=0..192,824.14 rows=6,612 width=397) (actual time=533.682..533.683 rows=0 loops=3)

  • Filter: (upper((billing_invoice_2.number)::text) ~~ 'A'::text)
  • Buffers: shared hit=172,987
31. 0.000 0.000 ↓ 0.0 0 0 / 3

Index Scan using customers_customer_pkey on customers_customer customers_customer_2 (cost=0.42..0.45 rows=1 width=800) (never executed)

  • Index Cond: (cards_order_2.created_by_id = customers_customer_2.id)
32. 0.000 0.000 ↓ 0.0 0 0 / 3

Index Scan using customers_customer_pkey on customers_customer t3_2 (cost=0.42..0.45 rows=1 width=800) (never executed)

  • Index Cond: (cards_order_2.customer_id = t3_2.id)
33. 0.000 0.000 ↓ 0.0 0 0 / 3

Index Scan using billing_payment_pkey on billing_payment billing_payment_2 (cost=0.43..6.36 rows=1 width=610) (never executed)

  • Index Cond: (billing_invoice_2.payment_id = billing_payment_2.id)
34. 5.728 850.356 ↑ 15,950.0 1 1

Gather (cost=1,001.7..806,212.2 rows=15,950 width=4,081) (actual time=616.419..850.356 rows=1 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
  • Buffers: shared hit=695,797
35. 0.003 844.628 ↓ 0.0 0 3 / 3

Nested Loop (cost=1.7..803,617.2 rows=6,646 width=4,081) (actual time=767.072..844.628 rows=0 loops=3)

  • Buffers: shared hit=695,797
36. 0.003 844.621 ↓ 0.0 0 3 / 3

Nested Loop (cost=1.27..799,718.02 rows=6,646 width=3,471) (actual time=767.064..844.621 rows=0 loops=3)

  • Buffers: shared hit=695,793
37. 0.003 844.614 ↓ 0.0 0 3 / 3

Nested Loop (cost=0.84..752,931.17 rows=6,646 width=3,074) (actual time=767.058..844.614 rows=0 loops=3)

  • Buffers: shared hit=695,789
38. 0.005 844.608 ↓ 0.0 0 3 / 3

Nested Loop (cost=0.42..734,324.81 rows=6,646 width=2,274) (actual time=767.052..844.608 rows=0 loops=3)

  • Buffers: shared hit=695,785
39. 844.597 844.597 ↓ 0.0 0 3 / 3

Seq Scan on cards_order cards_order_3 (cost=0..715,718.46 rows=6,646 width=1,474) (actual time=767.042..844.597 rows=0 loops=3)

  • Filter: (upper((cards_order_3.client_reference)::text) ~~ 'A'::text)
  • Buffers: shared hit=695,781
40. 0.006 0.006 ↑ 1.0 1 1 / 3

Index Scan using customers_customer_pkey on customers_customer customers_customer_3 (cost=0.42..2.8 rows=1 width=800) (actual time=0.019..0.019 rows=1 loops=1)

  • Index Cond: (cards_order_3.created_by_id = customers_customer_3.id)
  • Buffers: shared hit=4
41. 0.003 0.003 ↑ 1.0 1 1 / 3

Index Scan using customers_customer_pkey on customers_customer t3_3 (cost=0.42..2.8 rows=1 width=800) (actual time=0.009..0.009 rows=1 loops=1)

  • Index Cond: (cards_order_3.customer_id = t3_3.id)
  • Buffers: shared hit=4
42. 0.004 0.004 ↑ 1.0 1 1 / 3

Index Scan using billing_invoice_pkey on billing_invoice billing_invoice_3 (cost=0.43..7.04 rows=1 width=397) (actual time=0.01..0.011 rows=1 loops=1)

  • Index Cond: (cards_order_3.invoice_id = billing_invoice_3.id)
  • Buffers: shared hit=4
43. 0.004 0.004 ↑ 1.0 1 1 / 3

Index Scan using billing_payment_pkey on billing_payment billing_payment_3 (cost=0.43..0.59 rows=1 width=610) (actual time=0.011..0.012 rows=1 loops=1)

  • Index Cond: (billing_invoice_3.payment_id = billing_payment_3.id)
  • Buffers: shared hit=4
Planning time : 5.298 ms
Execution time : 2,390.483 ms