explain.depesz.com

PostgreSQL's explain analyze made readable

Result: R6JT6

Settings
# exclusive inclusive rows x rows loops node
1. 0.105 1,191.658 ↑ 1.0 50 1

Limit (cost=237,918.72..237,920.10 rows=50 width=127) (actual time=1,177.910..1,191.658 rows=50 loops=1)

  • Buffers: shared hit=119190 read=103609 dirtied=1, temp read=735 written=2325
  • I/O Timings: read=252.710
2. 9.298 1,191.553 ↑ 20.8 50 1

Unique (cost=237,918.72..237,947.38 rows=1,042 width=127) (actual time=1,177.909..1,191.553 rows=50 loops=1)

  • Buffers: shared hit=119190 read=103609 dirtied=1, temp read=735 written=2325
  • I/O Timings: read=252.710
3. 303.395 1,182.255 ↓ 14.7 15,296 1

Sort (cost=237,918.72..237,921.33 rows=1,042 width=127) (actual time=1,177.908..1,182.255 rows=15,296 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: 18528kB
  • Buffers: shared hit=119190 read=103609 dirtied=1, temp read=735 written=2325
  • I/O Timings: read=252.710
4. 112.718 878.860 ↓ 122.9 128,087 1

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

  • Workers Planned: 2
  • Workers Launched: 2
  • Buffers: shared hit=119190 read=103609 dirtied=1
  • I/O Timings: read=252.710
5. 12.828 766.142 ↓ 98.4 42,696 3 / 3

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

  • Buffers: shared hit=119190 read=103609 dirtied=1
  • I/O Timings: read=252.710
6. 0.488 739.025 ↑ 2.0 144 3 / 3

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

  • Buffers: shared hit=114652 read=103609 dirtied=1
  • I/O Timings: read=252.710
7. 267.965 737.094 ↑ 2.0 144 3 / 3

Hash Join (cost=226.33..236,247.22 rows=282 width=136) (actual time=56.746..737.094 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=113324 read=103609 dirtied=1
  • I/O Timings: read=252.710
8. 465.058 465.058 ↑ 1.2 386,613 3 / 3

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

  • Buffers: shared hit=112857 read=103609 dirtied=1
  • I/O Timings: read=252.710
9. 1.240 4.071 ↓ 1.0 2,648 3 / 3

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

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

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

  • Buffers: shared hit=407
11. 0.022 0.022 ↑ 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.020..0.022 rows=1 loops=3)

  • Index Cond: ((user_id)::text = 'bdd77988-7e21-4b7d-b87c-6730ee8b58ae'::text)
  • Filter: active
  • Buffers: shared hit=11
12. 1.016 1.016 ↓ 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.011..1.016 rows=2,648 loops=3)

  • Buffers: shared hit=396
13. 1.443 1.443 ↑ 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.010..0.010 rows=1 loops=433)

  • Index Cond: ((id)::text = (invoice0_.client_company_id)::text)
  • Buffers: shared hit=1328
14. 14.289 14.289 ↓ 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.017..0.099 rows=296 loops=433)

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