explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 888y

Settings
# exclusive inclusive rows x rows loops node
1. 0.059 1,446.731 ↑ 1.2 433 1

Limit (cost=237,918.72..237,932.47 rows=500 width=127) (actual time=1,310.177..1,446.731 rows=433 loops=1)

2. 78.482 1,446.672 ↑ 2.4 433 1

Unique (cost=237,918.72..237,947.38 rows=1,042 width=127) (actual time=1,310.176..1,446.672 rows=433 loops=1)

3. 405.218 1,368.190 ↓ 122.9 128,087 1

Sort (cost=237,918.72..237,921.33 rows=1,042 width=127) (actual time=1,310.175..1,368.190 rows=128,087 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
4. 145.332 962.972 ↓ 122.9 128,087 1

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

  • Workers Planned: 2
  • Workers Launched: 2
5. 14.139 817.640 ↓ 98.4 42,696 3 / 3

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

6. 1.877 787.047 ↑ 2.0 144 3 / 3

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

7. 288.052 781.706 ↑ 2.0 144 3 / 3

Hash Join (cost=226.33..236,247.22 rows=282 width=136) (actual time=65.771..781.706 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: 386461
8. 489.904 489.904 ↑ 1.2 386,606 3 / 3

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

9. 1.404 3.750 ↓ 1.0 2,648 3 / 3

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

  • Buckets: 4096 Batches: 1 Memory Usage: 495kB
10. 1.556 2.346 ↓ 1.0 2,648 3 / 3

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

11. 0.027 0.027 ↑ 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.025..0.027 rows=1 loops=3)

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

13. 3.464 3.464 ↑ 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.024..0.024 rows=1 loops=433)

  • Index Cond: ((id)::text = (invoice0_.client_company_id)::text)
14. 16.454 16.454 ↓ 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.114 rows=296 loops=433)

  • Index Cond: (invoice_id = (invoice0_.id)::text)
  • Heap Fetches: 15127
Planning time : 1.735 ms
Execution time : 1,450.893 ms