explain.depesz.com

PostgreSQL's explain analyze made readable

Result: nBYC

Settings
# exclusive inclusive rows x rows loops node
1. 0.289 395,540.093 ↓ 29.4 500 1

Limit (cost=25,932.68..102,800.77 rows=17 width=2,277) (actual time=387,507.036..395,540.093 rows=500 loops=1)

2. 7,965.008 395,539.804 ↓ 29.4 500 1

Nested Loop (cost=25,932.68..102,800.77 rows=17 width=2,277) (actual time=387,507.035..395,539.804 rows=500 loops=1)

3. 0.009 0.080 ↓ 2.0 2 1

Nested Loop (cost=0.29..36.75 rows=1 width=464) (actual time=0.067..0.080 rows=2 loops=1)

  • Join Filter: (t.poluch_id = p.poluch_id)
  • Rows Removed by Join Filter: 5
4. 0.001 0.065 ↓ 2.0 2 1

Nested Loop (cost=0.29..35.66 rows=1 width=230) (actual time=0.062..0.065 rows=2 loops=1)

5. 0.046 0.046 ↑ 1.0 1 1

Index Scan using dc_organization_adm_legacy_id_un on dc_organization dc (cost=0.29..34.59 rows=1 width=212) (actual time=0.046..0.046 rows=1 loops=1)

  • Index Cond: (adm_legacy_id IS NOT NULL)
  • Filter: ((code)::text = '45597'::text)
  • Rows Removed by Filter: 3
6. 0.018 0.018 ↓ 2.0 2 1

Seq Scan on kvit_splat t (cost=0.00..1.06 rows=1 width=26) (actual time=0.015..0.018 rows=2 loops=1)

  • Filter: (((ogai_kod)::text = '45597'::text) AND (uslug_id = '204'::numeric))
7. 0.006 0.006 ↑ 1.0 4 2

Seq Scan on kvit_spoluch p (cost=0.00..1.04 rows=4 width=245) (actual time=0.002..0.003 rows=4 loops=2)

8. 326,852.442 387,574.716 ↑ 13.6 250 2

Bitmap Heap Scan on docs_executive e (cost=25,932.40..102,717.29 rows=3,389 width=1,704) (actual time=193,727.856..193,787.358 rows=250 loops=2)

  • Recheck Cond: ((((status_id = '3'::numeric) AND ((ogai_sost_kod)::text = '45597'::text)) OR ((status_id = '4'::numeric) AND ((ogai_sost_kod)::text = '45597'::text))) AND (dat_sost >= trunc(t.date_from, 'DDD'::text)))
  • Rows Removed by Index Recheck: 82,066
  • Filter: ((dat_sost <= COALESCE(trunc(t.date_end, 'DDD'::text), dat_sost)) AND ((status_id = '3'::numeric) OR ((status_id = '4'::numeric) AND (alternatives: SubPlan 1 or hashed SubPlan 2))))
  • Rows Removed by Filter: 70,788
  • Heap Blocks: exact=90,011 lossy=56,258
9. 53.714 55,987.400 ↓ 0.0 0 2

BitmapAnd (cost=25,932.40..25,932.40 rows=19,011 width=0) (actual time=27,993.699..27,993.700 rows=0 loops=2)

10. 0.006 14,895.774 ↓ 0.0 0 2

BitmapOr (cost=1,029.24..1,029.24 rows=57,033 width=0) (actual time=7,447.887..7,447.887 rows=0 loops=2)

11. 3,084.612 3,084.612 ↓ 8.8 35,745 2

Bitmap Index Scan on docs_executive_status_id_kod (cost=0.00..73.55 rows=4,072 width=0) (actual time=1,542.306..1,542.306 rows=35,745 loops=2)

  • Index Cond: ((status_id = '3'::numeric) AND ((ogai_sost_kod)::text = '45597'::text))
12. 11,811.156 11,811.156 ↓ 2.8 150,580 2

Bitmap Index Scan on docs_executive_status_id_kod (cost=0.00..940.44 rows=52,961 width=0) (actual time=5,905.578..5,905.578 rows=150,580 loops=2)

  • Index Cond: ((status_id = '4'::numeric) AND ((ogai_sost_kod)::text = '45597'::text))
13. 41,037.912 41,037.912 ↓ 1.8 2,478,036 2

Bitmap Index Scan on docs_executive_dat_sost (cost=0.00..24,902.06 rows=1,413,336 width=0) (actual time=20,518.956..20,518.956 rows=2,478,036 loops=2)

  • Index Cond: (dat_sost >= trunc(t.date_from, 'DDD'::text))
14.          

SubPlan (for Bitmap Heap Scan)

15. 4,734.874 4,734.874 ↓ 0.0 0 100,742

Index Only Scan using docs_executive_response_idx1 on docs_executive_response r (cost=0.42..2.85 rows=1 width=0) (actual time=0.047..0.047 rows=0 loops=100,742)

  • Index Cond: ((docs_id = e.docs_id) AND (docs_type = '1'::numeric) AND (process_status = '-1'::numeric))
  • Heap Fetches: 0
16. 0.000 0.000 ↓ 0.0 0

Index Only Scan using docs_executive_response_idx1 on docs_executive_response r_1 (cost=0.42..16,983.58 rows=11,691 width=6) (never executed)

  • Index Cond: ((docs_type = '1'::numeric) AND (process_status = '-1'::numeric))
  • Heap Fetches: 0
Planning time : 4.215 ms
Execution time : 395,549.225 ms