explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 2scg

Settings
# exclusive inclusive rows x rows loops node
1. 0.089 1.021 ↑ 382.5 2 1

Append (cost=1,366.72..26,402.53 rows=765 width=12) (actual time=0.912..1.021 rows=2 loops=1)

  • Async subplans: 1
2. 0.409 0.409 ↑ 383.0 1 1

Async Foreign Scan (cost=101.99..26,398.71 rows=383 width=12) (actual time=0.384..0.409 rows=1 loops=1)

  • Output: (sum(documents_1.id)), documents_1.company_id
  • Relations: Aggregate on (public.documents_node2 documents_1)
  • Remote SQL: SELECT sum(id), company_id FROM public.documents_node2 WHERE (((company_id = 5) OR (company_id = 1))) GROUP BY 2
3. 0.083 0.523 ↑ 382.0 1 1

HashAggregate (cost=1,366.72..1,370.54 rows=382 width=12) (actual time=0.520..0.523 rows=1 loops=1)

  • Output: sum(documents.id), documents.company_id
  • Group Key: documents.company_id
  • Peak Memory Usage: 37 kB
4. 0.392 0.440 ↑ 2.0 196 1

Bitmap Heap Scan on public.documents_node1 documents (cost=12.03..1,364.73 rows=397 width=8) (actual time=0.093..0.440 rows=196 loops=1)

  • Output: documents.company_id, documents.id
  • Recheck Cond: ((documents.company_id = 5) OR (documents.company_id = 1))
  • Heap Blocks: exact=194
5. 0.002 0.048 ↓ 0.0 0 1

BitmapOr (cost=12.03..12.03 rows=397 width=0) (actual time=0.048..0.048 rows=0 loops=1)

6. 0.018 0.018 ↓ 0.0 0 1

Bitmap Index Scan on documents_pk (cost=0.00..5.92 rows=199 width=0) (actual time=0.018..0.018 rows=0 loops=1)

  • Index Cond: (documents.company_id = 5)
7. 0.028 0.028 ↑ 1.0 196 1

Bitmap Index Scan on documents_pk (cost=0.00..5.92 rows=199 width=0) (actual time=0.028..0.028 rows=196 loops=1)

  • Index Cond: (documents.company_id = 1)
Planning time : 0.298 ms
Execution time : 1.508 ms