explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gV7e

Settings
# exclusive inclusive rows x rows loops node
1. 246.435 9,652.576 ↓ 0.0 0 1

GroupAggregate (cost=340,011.28..340,020.60 rows=373 width=74) (actual time=9,652.576..9,652.576 rows=0 loops=1)

  • Output: access_to_doc.id, access_to_doc.document_id
  • Group Key: access_to_doc.id
  • Filter: (every((document_tags.tag_id = '41a10248-afb5-4379-b44e-aa9f26dea620'::uuid)) AND bool_or(((document_tags.document_id)::text = '80772da1-d07b-4e60-85e4-40fef5938f9a'::text)))
  • Rows Removed by Filter: 729709
  • Buffers: shared hit=3119356 read=289646 written=758, temp read=93944 written=93930
2. 3,590.536 9,406.141 ↓ 2,774.3 1,034,797 1

Sort (cost=340,011.28..340,012.21 rows=373 width=127) (actual time=9,011.168..9,406.141 rows=1,034,797 loops=1)

  • Output: access_to_doc.id, access_to_doc.document_id, document_tags.tag_id, document_tags.document_id
  • Sort Key: access_to_doc.id
  • Sort Method: external merge Disk: 138568kB
  • Buffers: shared hit=3119356 read=289646 written=758, temp read=93944 written=93930
3. 1,027.564 5,815.605 ↓ 2,774.3 1,034,797 1

Hash Join (cost=225,282.46..339,995.34 rows=373 width=127) (actual time=4,765.704..5,815.605 rows=1,034,797 loops=1)

  • Output: access_to_doc.id, access_to_doc.document_id, document_tags.tag_id, document_tags.document_id
  • Hash Cond: ((document_tags.tag_id = role_tag.tag_id) AND ((document_tags.document_id)::text = (access_to_doc.document_id)::text))
  • Buffers: shared hit=3119356 read=289646 written=758, temp read=76619 written=76605
4. 23.191 23.191 ↓ 1.0 165,764 1

Seq Scan on public.document_tags (cost=0.00..5,513.68 rows=164,068 width=53) (actual time=0.005..23.191 rows=165,764 loops=1)

  • Output: document_tags.tag_id, document_tags.document_id
  • Buffers: shared hit=1 read=3872
5. 1,041.714 4,764.850 ↓ 2.3 4,337,411 1

Hash (cost=169,324.97..169,324.97 rows=1,887,366 width=90) (actual time=4,764.850..4,764.850 rows=4,337,411 loops=1)

  • Output: role_tag.tag_id, access_to_doc.id, access_to_doc.document_id
  • Buckets: 1048576 (originally 1048576) Batches: 8 (originally 2) Memory Usage: 122881kB
  • Buffers: shared hit=3119355 read=285774 written=758, temp written=50991
6. 531.801 3,723.136 ↓ 2.3 4,337,411 1

Merge Join (cost=1.05..169,324.97 rows=1,887,366 width=90) (actual time=0.505..3,723.136 rows=4,337,411 loops=1)

  • Output: role_tag.tag_id, access_to_doc.id, access_to_doc.document_id
  • Merge Cond: (role_tag.role_id = access_to_doc.role_id)
  • Buffers: shared hit=3119355 read=285774 written=758
7. 2.020 2.020 ↓ 1.0 3,522 1

Index Only Scan using uix_role_tag on public.role_tag (cost=0.28..121.22 rows=3,480 width=32) (actual time=0.010..2.020 rows=3,522 loops=1)

  • Output: role_tag.role_id, role_tag.tag_id
  • Heap Fetches: 1822
  • Buffers: shared hit=1145 read=82
8. 3,189.315 3,189.315 ↑ 1.0 6,627,547 1

Index Scan using ix_access_to_doc_role_id on public.access_to_doc (cost=0.43..282,712.08 rows=6,673,286 width=90) (actual time=0.008..3,189.315 rows=6,627,547 loops=1)

  • Output: access_to_doc.id, access_to_doc.document_id, access_to_doc.role_id
  • Buffers: shared hit=3118210 read=285692 written=758
Planning time : 1.165 ms
Execution time : 9,670.339 ms