explain.depesz.com

PostgreSQL's explain analyze made readable

Result: rpzq

Settings
# exclusive inclusive rows x rows loops node
1. 0.006 2,746.381 ↓ 0.0 0 1

Sort (cost=12,445.39..12,445.40 rows=4 width=91) (actual time=2,746.381..2,746.381 rows=0 loops=1)

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

Nested Loop Left Join (cost=4,888.56..12,445.35 rows=4 width=91) (actual time=2,746.375..2,746.375 rows=0 loops=1)

3. 0.000 2,746.373 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,888.29..12,444.09 rows=4 width=60) (actual time=2,746.373..2,746.373 rows=0 loops=1)

4. 0.721 2,746.373 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,888.00..12,440.43 rows=4 width=60) (actual time=2,746.373..2,746.373 rows=0 loops=1)

  • Filter: (cm.send_at IS NULL)
  • Rows Removed by Filter: 1,069
5. 53.844 2,563.230 ↓ 2.8 926 1

Nested Loop Left Join (cost=4,887.58..10,897.31 rows=329 width=52) (actual time=1,874.296..2,563.230 rows=926 loops=1)

  • Filter: (dg.postivo_result IS NULL)
  • Rows Removed by Filter: 6,147
6. 174.881 2,240.612 ↓ 1.2 7,073 1

Hash Right Join (cost=4,887.29..6,843.65 rows=5,847 width=53) (actual time=1,874.288..2,240.612 rows=7,073 loops=1)

  • Hash Cond: (dr.payment_id = p.payment_id)
7. 194.284 194.284 ↑ 1.0 83,594 1

Seq Scan on dispatch_rows dr (cost=0.00..1,586.45 rows=83,845 width=8) (actual time=0.008..194.284 rows=83,594 loops=1)

8. 2.139 1,871.447 ↓ 1.2 7,073 1

Hash (cost=4,814.20..4,814.20 rows=5,847 width=49) (actual time=1,871.447..1,871.447 rows=7,073 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 672kB
9. 1,869.308 1,869.308 ↓ 1.2 7,073 1

Seq Scan on payments p (cost=0.00..4,814.20 rows=5,847 width=49) (actual time=0.211..1,869.308 rows=7,073 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() - '30 days'::interval)))
  • Rows Removed by Filter: 81,247
10. 268.774 268.774 ↑ 1.0 1 7,073

Index Scan using dispatch_groups_dispatch_group_id_index on dispatch_groups dg (cost=0.29..0.68 rows=1 width=7) (actual time=0.038..0.038 rows=1 loops=7,073)

  • Index Cond: (dr.dispatch_group_id = dispatch_group_id)
11. 182.422 182.422 ↑ 1.0 1 926

Index Scan using client_messages_external_payment_id_index on client_messages cm (cost=0.42..4.68 rows=1 width=15) (actual time=0.100..0.197 rows=1 loops=926)

  • Index Cond: ((external_payment_id)::text = (p.external_id)::text)
12. 0.000 0.000 ↓ 0.0 0

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

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

Index Scan using einvoice_accept_client_id_index on einvoice_accept ea (cost=0.28..0.30 rows=1 width=34) (never executed)

  • Index Cond: (c.client_id = client_id)
  • Filter: accept_complete
Planning time : 1.312 ms
Execution time : 2,746.505 ms