explain.depesz.com

PostgreSQL's explain analyze made readable

Result: nw4W

Settings
# exclusive inclusive rows x rows loops node
1. 0.089 1,408.347 ↑ 1.0 5 1

Limit (cost=237,918.72..237,918.86 rows=5 width=127) (actual time=1,405.826..1,408.347 rows=5 loops=1)

  • Buffers: shared hit=119284 read=103513, temp read=490 written=2326
  • I/O Timings: read=283.522
2. 1.627 1,408.258 ↑ 208.4 5 1

Unique (cost=237,918.72..237,947.38 rows=1,042 width=127) (actual time=1,405.825..1,408.258 rows=5 loops=1)

  • Buffers: shared hit=119284 read=103513, temp read=490 written=2326
  • I/O Timings: read=283.522
3. 395.141 1,406.631 ↓ 2.6 2,685 1

Sort (cost=237,918.72..237,921.33 rows=1,042 width=127) (actual time=1,405.824..1,406.631 rows=2,685 loops=1)

  • Sort Key: invoice0_.invoice_date DESC, invoice0_.id, invoice0_.source, invoice0_.invoice_number, invoice0_.created_timestamp, company2_.name, company2_.rs_number, company1_.name, company1_.rs_number, invoice0_.amount
  • Sort Method: external merge Disk: 18536kB
  • Buffers: shared hit=119284 read=103513, temp read=490 written=2326
  • I/O Timings: read=283.522
4. 215.580 1,011.490 ↓ 122.9 128,087 1

Gather (cost=1,227.16..237,866.49 rows=1,042 width=127) (actual time=62.943..1,011.490 rows=128,087 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
  • Buffers: shared hit=119284 read=103513
  • I/O Timings: read=283.522
5. 10.294 795.910 ↓ 98.4 42,696 3 / 3

Nested Loop (cost=227.16..236,762.29 rows=434 width=127) (actual time=53.978..795.910 rows=42,696 loops=3)

  • Buffers: shared hit=119284 read=103513
  • I/O Timings: read=283.522
6. 1.024 770.172 ↑ 2.0 144 3 / 3

Nested Loop (cost=226.61..236,331.26 rows=282 width=127) (actual time=53.930..770.172 rows=144 loops=3)

  • Buffers: shared hit=114748 read=103513
  • I/O Timings: read=283.522
7. 280.225 767.849 ↑ 2.0 144 3 / 3

Hash Join (cost=226.33..236,247.22 rows=282 width=136) (actual time=53.891..767.849 rows=144 loops=3)

  • Hash Cond: ((invoice0_.supplier_company_id)::text = (company2_.id)::text)
  • Join Filter: ((((useraccess4_.site_id)::text = (invoice0_.supplier_site_id)::text) OR ((useraccess4_.site_id)::text = (company2_.main_site_id)::text)) AND (((useraccess4_.type)::text = 'ALL'::text) OR (((useraccess4_.type)::text = 'MRT'::text) AND ((invoice0_.source)::text = 'MRT'::text)) OR (((useraccess4_.type)::text = 'ORD'::text) AND ((invoice0_.source)::text = 'ORD'::text))))
  • Rows Removed by Join Filter: 386469
  • Buffers: shared hit=113420 read=103513
  • I/O Timings: read=283.522
8. 484.182 484.182 ↑ 1.2 386,614 3 / 3

Parallel Seq Scan on tbl_invoice invoice0_ (cost=0.00..221,206.58 rows=474,058 width=182) (actual time=0.006..484.182 rows=386,614 loops=3)

  • Buffers: shared hit=112953 read=103513
  • I/O Timings: read=283.522
9. 1.209 3.442 ↓ 1.0 2,648 3 / 3

Hash (cost=193.24..193.24 rows=2,647 width=143) (actual time=3.442..3.442 rows=2,648 loops=3)

  • Buckets: 4096 Batches: 1 Memory Usage: 495kB
  • Buffers: shared hit=407
10. 1.151 2.233 ↓ 1.0 2,648 3 / 3

Nested Loop (cost=0.29..193.24 rows=2,647 width=143) (actual time=0.476..2.233 rows=2,648 loops=3)

  • Buffers: shared hit=407
11. 0.023 0.023 ↑ 1.0 1 3 / 3

Index Scan using idx_user_access_2_user on tbl_user_access useraccess4_ (cost=0.29..8.30 rows=1 width=41) (actual time=0.021..0.023 rows=1 loops=3)

  • Index Cond: ((user_id)::text = 'bdd77988-7e21-4b7d-b87c-6730ee8b58ae'::text)
  • Filter: active
  • Buffers: shared hit=11
12. 1.059 1.059 ↓ 1.0 2,648 3 / 3

Seq Scan on tbl_company company2_ (cost=0.00..158.47 rows=2,647 width=102) (actual time=0.452..1.059 rows=2,648 loops=3)

  • Buffers: shared hit=396
13. 1.299 1.299 ↑ 1.0 1 433 / 3

Index Scan using tbl_company_pkey on tbl_company company1_ (cost=0.28..0.30 rows=1 width=65) (actual time=0.009..0.009 rows=1 loops=433)

  • Index Cond: ((id)::text = (invoice0_.client_company_id)::text)
  • Buffers: shared hit=1328
14. 15.444 15.444 ↓ 9.9 296 433 / 3

Index Only Scan using idx_invoice_line_invoice_id on tbl_invoice_line lines3_ (cost=0.55..1.23 rows=30 width=37) (actual time=0.020..0.107 rows=296 loops=433)

  • Index Cond: (invoice_id = (invoice0_.id)::text)
  • Heap Fetches: 15127
  • Buffers: shared hit=4536
Planning time : 1.737 ms
Execution time : 1,412.174 ms