explain.depesz.com

PostgreSQL's explain analyze made readable

Result: YEyW

Settings
# exclusive inclusive rows x rows loops node
1. 0.075 13,782.989 ↑ 1.0 1 1

Sort (cost=420,339.85..420,339.85 rows=1 width=227) (actual time=13,782.989..13,782.989 rows=1 loops=1)

  • Sort Key: p.tel_idklienta, mg.tmg_idmagazynu, p.tr_idtrans, (sortkonta(numerkonta(p.tel_lpprefix, (p.tel_sortorder)::text), 5)), (random())
  • Sort Method: quicksort Memory: 25kB
2. 172.426 13,782.914 ↑ 1.0 1 1

Hash Semi Join (cost=336,791.10..420,339.84 rows=1 width=227) (actual time=12,519.459..13,782.914 rows=1 loops=1)

  • Hash Cond: (p.tel_idelem = COALESCE(r.tel_idpzam, subte.tel_idelem))
3. 502.003 13,610.391 ↓ 4.0 2,510,103 1

Hash Join (cost=336,778.19..418,669.67 rows=631,135 width=166) (actual time=7,842.606..13,610.391 rows=2,510,103 loops=1)

  • Hash Cond: (tg_towmag.tmg_idmagazynu = mg.tmg_idmagazynu)
4. 2,106.562 13,108.311 ↓ 4.0 2,510,103 1

Hash Join (cost=336,773.79..416,935.40 rows=631,135 width=166) (actual time=7,842.506..13,108.311 rows=2,510,103 loops=1)

  • Hash Cond: (p.ttm_idtowmag = tg_towmag.ttm_idtowmag)
5. 2,020.729 10,955.606 ↓ 4.0 2,510,103 1

Hash Join (cost=331,647.16..380,237.96 rows=631,135 width=162) (actual time=7,796.274..10,955.606 rows=2,510,103 loops=1)

  • Hash Cond: (p.ttw_idtowaru = towar.ttw_idtowaru)
6. 1,138.780 8,847.082 ↓ 3.4 2,520,823 1

Hash Right Join (cost=305,498.66..320,948.82 rows=751,817 width=143) (actual time=7,708.345..8,847.082 rows=2,520,823 loops=1)

  • Hash Cond: (tg_udzielonerabaty.tel_idelem = p.tel_idelem)
7. 0.025 0.025 ↓ 0.0 0 1

Seq Scan on tg_udzielonerabaty (cost=0.00..18.10 rows=810 width=4) (actual time=0.025..0.025 rows=0 loops=1)

8. 1,181.530 7,708.277 ↓ 3.4 2,520,823 1

Hash (cost=280,681.95..280,681.95 rows=751,817 width=143) (actual time=7,708.277..7,708.277 rows=2,520,823 loops=1)

  • Buckets: 2048 (originally 2048) Batches: 2048 (originally 512) Memory Usage: 334kB
9. 1,650.217 6,526.747 ↓ 3.4 2,520,823 1

Hash Right Join (cost=248,269.59..280,681.95 rows=751,817 width=143) (actual time=4,882.998..6,526.747 rows=2,520,823 loops=1)

  • Hash Cond: (stat_hist.sh_idref = p.tel_idelem)
  • Filter: (COALESCE((statusy.st_flaga & 8), 0) = 0)
10. 2.176 7.704 ↓ 1.1 10,451 1

Hash Left Join (cost=321.13..1,792.66 rows=9,841 width=8) (actual time=0.955..7.704 rows=10,451 loops=1)

  • Hash Cond: (stat_hist.st_idstatusu = statusy.st_idstatusu)
11. 4.684 5.494 ↓ 1.1 10,451 1

Bitmap Heap Scan on tg_statusyhistoria stat_hist (cost=317.67..1,761.68 rows=9,841 width=8) (actual time=0.901..5.494 rows=10,451 loops=1)

  • Recheck Cond: (sh_type = 17)
  • Filter: sh_aktualny
  • Heap Blocks: exact=856
12. 0.810 0.810 ↓ 1.1 10,451 1

Bitmap Index Scan on tg_statusyhistora_tid (cost=0.00..315.21 rows=9,841 width=0) (actual time=0.810..0.810 rows=10,451 loops=1)

  • Index Cond: ((sh_type = 17) AND (sh_aktualny = true))
13. 0.010 0.034 ↑ 1.0 65 1

Hash (cost=2.65..2.65 rows=65 width=8) (actual time=0.034..0.034 rows=65 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
14. 0.024 0.024 ↑ 1.0 65 1

Seq Scan on ts_statusy statusy (cost=0.00..2.65 rows=65 width=8) (actual time=0.013..0.024 rows=65 loops=1)

15. 1,703.961 4,868.826 ↓ 1.7 2,520,823 1

Hash (cost=198,316.04..198,316.04 rows=1,503,634 width=143) (actual time=4,868.826..4,868.826 rows=2,520,823 loops=1)

  • Buckets: 2048 (originally 2048) Batches: 2048 (originally 1024) Memory Usage: 334kB
16. 3,164.865 3,164.865 ↓ 1.7 2,520,823 1

Seq Scan on tg_transelem p (cost=0.00..198,316.04 rows=1,503,634 width=143) (actual time=0.043..3,164.865 rows=2,520,823 loops=1)

  • Filter: ((tel_flaga & 4224) = 0)
  • Rows Removed by Filter: 486462
17. 13.706 87.795 ↑ 1.0 56,100 1

Hash (cost=25,118.25..25,118.25 rows=56,100 width=23) (actual time=87.795..87.795 rows=56,100 loops=1)

  • Buckets: 8192 Batches: 16 Memory Usage: 272kB
18. 74.089 74.089 ↑ 1.0 56,100 1

Seq Scan on tg_towary towar (cost=0.00..25,118.25 rows=56,100 width=23) (actual time=0.016..74.089 rows=56,100 loops=1)

  • Filter: (NOT istmptowar(ttw_flaga))
  • Rows Removed by Filter: 10720
19. 22.275 46.143 ↑ 1.0 83,850 1

Hash (cost=3,750.50..3,750.50 rows=83,850 width=8) (actual time=46.143..46.143 rows=83,850 loops=1)

  • Buckets: 8192 Batches: 16 Memory Usage: 276kB
20. 23.868 23.868 ↑ 1.0 83,850 1

Seq Scan on tg_towmag (cost=0.00..3,750.50 rows=83,850 width=8) (actual time=0.004..23.868 rows=83,850 loops=1)

21. 0.029 0.077 ↑ 1.0 96 1

Hash (cost=3.20..3.20 rows=96 width=4) (actual time=0.077..0.077 rows=96 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
22. 0.048 0.048 ↑ 1.0 96 1

Seq Scan on tg_magazyny mg (cost=0.00..3.20 rows=96 width=4) (actual time=0.010..0.048 rows=96 loops=1)

  • Filter: (fm_idcentrali = 1)
23. 0.010 0.097 ↑ 1.0 1 1

Hash (cost=12.90..12.90 rows=1 width=8) (actual time=0.097..0.097 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
24. 0.003 0.087 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.85..12.90 rows=1 width=8) (actual time=0.086..0.087 rows=1 loops=1)

  • Join Filter: (subte.tel_idelem = r.tel_idelemsrc)
25. 0.055 0.055 ↑ 1.0 1 1

Index Only Scan using tg_transelem_pkey on tg_transelem subte (cost=0.43..4.45 rows=1 width=4) (actual time=0.055..0.055 rows=1 loops=1)

  • Index Cond: (tel_idelem = 3290577)
  • Heap Fetches: 0
26. 0.029 0.029 ↓ 0.0 0 1

Index Scan using tg_realizacjapzam_index2 on tg_realizacjapzam r (cost=0.42..8.45 rows=1 width=8) (actual time=0.029..0.029 rows=0 loops=1)

  • Index Cond: (tel_idelemsrc = 3290577)
  • Filter: (rm_powod = 4)