explain.depesz.com

PostgreSQL's explain analyze made readable

Result: MuyA

Settings
# exclusive inclusive rows x rows loops node
1. 0.054 2.019 ↑ 397.5 2 1

GroupAggregate (cost=27,800.19..27,814.10 rows=795 width=12) (actual time=1.955..2.019 rows=2 loops=1)

  • Output: sum(documents.id), documents.company_id
  • Group Key: documents.company_id
  • WHERE (((company_id = 5) OR (company_id = 1)))
2. 0.138 1.918 ↑ 2.0 399 1

Sort (cost=27,800.19..27,802.18 rows=795 width=8) (actual time=1.887..1.918 rows=399 loops=1)

  • Output: documents.company_id, documents.id
  • Sort Key: documents.company_id
  • Sort Method: quicksort Memory: 46kB
3. 1.359 1.780 ↑ 2.0 399 1

Append (cost=12.03..27,761.89 rows=795 width=8) (actual time=0.092..1.780 rows=399 loops=1)

4. 0.373 0.421 ↑ 2.0 196 1

Bitmap Heap Scan on public.documents_node1 documents_1 (cost=12.03..1,364.73 rows=397 width=8) (actual time=0.091..0.421 rows=196 loops=1)

  • Output: documents_1.company_id, documents_1.id
  • Recheck Cond: ((documents_1.company_id = 5) OR (documents_1.company_id = 1))
  • Heap Blocks: exact=194
5. 0.048 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)

  • -> Bitmap Index Scan on documents_pk (cost=0.00..5.92
6. 0.019 0.019 ↓ 0.0 0 1

rows=199 width=0) (cost=0..0 rows=0 width=0) (actual time=0.019..0.019 rows=0 loops=1)

  • Index Cond: (documents_1.company_id = 5)
  • -> Bitmap Index Scan on documents_pk (cost=0.00..5.92
7. 0.000 0.028 ↓ 0.0 196 1

rows=199 width=0) (cost=0..0 rows=0 width=0) (actual time=0.028..0.028 rows=196 loops=1)

  • Index Cond: (documents_1.company_id = 1)
8. 1.299 1.299 ↑ 2.0 203 1

Foreign Scan on public.documents_node2 documents_2 (cost=100.00..26,393.18 rows=398 width=8) (actual time=0.784..1.299 rows=203 loops=1)

  • Output: documents_2.company_id, documents_2.id
  • Remote SQL: SELECT company_id, id FROM public.documents_node2
Planning time : 0.259 ms
Execution time : 2.510 ms