explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gA1o

Settings
# exclusive inclusive rows x rows loops node
1. 0.716 2,442.061 ↑ 2.7 540 1

Unique (cost=557,891.74..557,923.96 rows=1,432 width=215) (actual time=2,441.272..2,442.061 rows=540 loops=1)

2. 2.164 2,441.345 ↑ 1.2 1,190 1

Sort (cost=557,891.74..557,895.32 rows=1,432 width=215) (actual time=2,441.272..2,441.345 rows=1,190 loops=1)

  • Sort Key: documents.id, documents.title, users.email, users.first_name, companies.name, companies.edrpou, roles.id, roles.can_receive_notifications
  • Sort Method: quicksort Memory: 590kB
3. 0.910 2,439.181 ↑ 1.2 1,190 1

Nested Loop (cost=3.21..557,816.67 rows=1,432 width=215) (actual time=17.607..2,439.181 rows=1,190 loops=1)

4. 0.446 2,434.701 ↑ 1.2 1,190 1

Nested Loop (cost=2.79..557,136.89 rows=1,432 width=181) (actual time=17.602..2,434.701 rows=1,190 loops=1)

5. 0.361 2,428.305 ↑ 1.2 1,190 1

Nested Loop (cost=2.38..556,432.68 rows=1,432 width=170) (actual time=17.594..2,428.305 rows=1,190 loops=1)

6. 0.868 2,424.374 ↑ 1.2 1,190 1

Nested Loop (cost=1.96..555,768.69 rows=1,432 width=116) (actual time=17.587..2,424.374 rows=1,190 loops=1)

  • Join Filter: ((document_signers_1.document_id)::text = (documents.id)::text)
7. 50.904 2,411.606 ↑ 1.2 1,190 1

Merge Join (cost=1.40..553,577.32 rows=1,432 width=90) (actual time=17.564..2,411.606 rows=1,190 loops=1)

  • Merge Cond: (((document_signers_1.document_id)::text = (document_signers.document_id)::text) AND (document_signers_1.company_id = document_signers.company_id))
8. 77.775 2,241.661 ↑ 246.0 540 1

GroupAggregate (cost=0.98..533,592.56 rows=132,835 width=53) (actual time=16.498..2,241.661 rows=540 loops=1)

  • Group Key: document_signers_1.document_id, document_signers_1.company_id
  • Filter: (every((signatures.id IS NOT NULL)) AND (max(signatures.date_created) > '2019-09-29 00:00:00+00'::timestamp with time zone))
  • Rows Removed by Filter: 171,520
9. 20.519 2,163.886 ↑ 1.0 285,828 1

Nested Loop Left Join (cost=0.98..529,399.80 rows=286,441 width=98) (actual time=0.019..2,163.886 rows=285,828 loops=1)

10. 142.571 142.571 ↑ 1.0 285,828 1

Index Scan using uix_document_signers_doc_company_order on document_signers document_signers_1 (cost=0.42..16,545.71 rows=286,441 width=69) (actual time=0.010..142.571 rows=285,828 loops=1)

11. 2,000.796 2,000.796 ↑ 1.0 1 285,828

Index Scan using idx_signatures_role_id_document_id on signatures (cost=0.56..1.78 rows=1 width=98) (actual time=0.007..0.007 rows=1 loops=285,828)

  • Index Cond: (((document_signers_1.document_id)::text = (document_id)::text) AND (document_signers_1.role_id = role_id))
12. 119.041 119.041 ↑ 1.0 285,801 1

Index Scan using uix_document_signers_doc_company_order on document_signers (cost=0.42..16,545.71 rows=286,441 width=69) (actual time=0.004..119.041 rows=285,801 loops=1)

13. 11.900 11.900 ↑ 1.0 1 1,190

Index Scan using documents_pkey on documents (cost=0.56..1.52 rows=1 width=100) (actual time=0.008..0.010 rows=1 loops=1,190)

  • Index Cond: ((id)::text = (document_signers.document_id)::text)
14. 3.570 3.570 ↑ 1.0 1 1,190

Index Scan using roles_pkey on roles (cost=0.42..0.45 rows=1 width=70) (actual time=0.003..0.003 rows=1 loops=1,190)

  • Index Cond: (id = document_signers.assigner)
15. 5.950 5.950 ↑ 1.0 1 1,190

Index Scan using users_pkey on users (cost=0.42..0.48 rows=1 width=85) (actual time=0.005..0.005 rows=1 loops=1,190)

  • Index Cond: ((id)::text = (roles.user_id)::text)
16. 3.570 3.570 ↑ 1.0 1 1,190

Index Scan using companies_pkey on companies (cost=0.42..0.46 rows=1 width=66) (actual time=0.002..0.003 rows=1 loops=1,190)

  • Index Cond: (id = roles.company_id)
Planning time : 1.702 ms
Execution time : 2,442.135 ms