explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qnKw

Settings
# exclusive inclusive rows x rows loops node
1. 0.021 5,429.794 ↓ 0.0 0 1

Sort (cost=13,072.62..13,072.63 rows=7 width=91) (actual time=5,429.794..5,429.794 rows=0 loops=1)

  • Sort Key: ((p.invoice_date > ea.accepted_at)) DESC
  • Sort Method: quicksort Memory: 25kB
2. 0.000 5,429.773 ↓ 0.0 0 1

Hash Left Join (cost=5,688.24..13,072.52 rows=7 width=91) (actual time=5,429.773..5,429.773 rows=0 loops=1)

  • Hash Cond: (c.client_id = ea.client_id)
3. 0.002 5,429.773 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,599.29..12,983.49 rows=7 width=60) (actual time=5,429.773..5,429.773 rows=0 loops=1)

4. 105.184 5,429.771 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,599.00..12,979.10 rows=7 width=60) (actual time=5,429.771..5,429.771 rows=0 loops=1)

  • Filter: (dg.postivo_result IS NULL)
  • Rows Removed by Filter: 12,570
5. 196.200 4,784.077 ↓ 101.4 12,570 1

Nested Loop Left Join (cost=5,598.71..12,891.91 rows=124 width=61) (actual time=3,573.785..4,784.077 rows=12,570 loops=1)

6. 260.080 4,147.927 ↓ 101.4 12,570 1

Merge Right Join (cost=5,598.42..12,802.54 rows=124 width=57) (actual time=3,573.773..4,147.927 rows=12,570 loops=1)

  • Merge Cond: ((cm.external_payment_id)::text = (p.external_id)::text)
  • Filter: (cm.send_at IS NULL)
  • Rows Removed by Filter: 1,885
7. 374.686 374.686 ↑ 26.5 9,503 1

Index Scan using client_messages_external_payment_id_index on client_messages cm (cost=0.42..187,462.71 rows=251,506 width=15) (actual time=0.027..374.686 rows=9,503 loops=1)

8. 780.130 3,513.161 ↓ 1.3 14,455 1

Sort (cost=5,598.00..5,626.62 rows=11,449 width=49) (actual time=3,452.078..3,513.161 rows=14,455 loops=1)

  • Sort Key: p.external_id
  • Sort Method: quicksort Memory: 2,377kB
9. 2,733.031 2,733.031 ↓ 1.2 14,172 1

Seq Scan on payments p (cost=0.00..4,826.17 rows=11,449 width=49) (actual time=0.348..2,733.031 rows=14,172 loops=1)

  • Filter: (pdf_exists AND (NOT print_psi) AND to_send AND ((invoice_number)::text !~~* '%/HT/%'::text) AND (company_id = 11) AND (created_at >= (now() - '60 days'::interval)))
  • Rows Removed by Filter: 74,148
10. 439.950 439.950 ↑ 1.0 1 12,570

Index Scan using dispatch_rows_payment_id_index on dispatch_rows dr (cost=0.29..0.71 rows=1 width=8) (actual time=0.032..0.035 rows=1 loops=12,570)

  • Index Cond: (p.payment_id = payment_id)
11. 540.510 540.510 ↑ 1.0 1 12,570

Index Scan using dispatch_groups_pkey on dispatch_groups dg (cost=0.29..0.69 rows=1 width=7) (actual time=0.040..0.043 rows=1 loops=12,570)

  • Index Cond: (dr.dispatch_group_id = dispatch_group_id)
12. 0.000 0.000 ↓ 0.0 0

Index Only Scan using clients_client_id_deleted_index on clients c (cost=0.29..0.62 rows=1 width=4) (never executed)

  • Index Cond: (client_id = p.client_id)
  • Heap Fetches: 0
13. 0.000 0.000 ↓ 0.0 0

Hash (cost=67.48..67.48 rows=1,717 width=34) (never executed)

14. 0.000 0.000 ↓ 0.0 0

Seq Scan on einvoice_accept ea (cost=0.00..67.48 rows=1,717 width=34) (never executed)

  • Filter: accept_complete
Planning time : 1.422 ms
Execution time : 5,429.947 ms