explain.depesz.com

A tool for finding a real cause for slow queries.

Result: TrP

options
exclusive inclusive rows x rows loops node
0.007 1888.954 ↓ 1.2 47 1

Append (cost=1044669.70..1129798.78 rows=38 width=108) (actual time=1888.337..1888.954 rows=47 loops=1)

0.054 1888.438 ↓ 1.3 47 1

Subquery Scan "*SELECT* 1" (cost=1044669.70..1044670.16 rows=37 width=108) (actual time=1888.336..1888.438 rows=47 loops=1)

6.468 1888.384 ↓ 1.3 47 1

HashAggregate (cost=1044669.70..1044669.79 rows=37 width=108) (actual time=1888.331..1888.384 rows=47 loops=1)

484.307 1881.916 ↓ 99.3 3673 1

Nested Loop (cost=36.57..1044669.24 rows=37 width=108) (actual time=0.204..1881.916 rows=3673 loops=1)

  • Join Filter: ((((subplan))::numeric = ("inner".id)::numeric) OR (("outer".department_id)::numeric = ("inner".id)::numeric))
94.437 479.359 ↓ 76.5 3673 1

Nested Loop Left Join (cost=36.57..1032143.84 rows=48 width=120) (actual time=0.189..479.359 rows=3673 loops=1)

  • Join Filter: ("inner".id = "outer".department_id)
6.046 307.789 ↓ 76.5 3673 1

Nested Loop Left Join (cost=36.57..1032013.76 rows=48 width=120) (actual time=0.127..307.789 rows=3673 loops=1)

6.684 298.070 ↓ 76.5 3673 1

Nested Loop (cost=36.57..1031074.55 rows=48 width=92) (actual time=0.117..298.070 rows=3673 loops=1)

233.091 278.039 ↓ 39.4 4449 1

Seq Scan on acc_trans ac (cost=36.57..1030457.51 rows=113 width=24) (actual time=0.095..278.039 rows=4449 loops=1)

  • Filter: ((taxdate >= '2011-01-01'::date) AND (taxdate <= '2011-01-31'::date) AND (approved = true) AND (NOT (hashed subplan)) AND ((((subplan))::numeric = 39920::numeric) OR ((department_id)::numeric = 39920::numeric)))
         

SubPlan (forSeq Scan)

44.948 44.948 ↓ 0.0 0 22474

Index Scan using invoice_pkey on invoice ii (cost=0.00..3.39 rows=1 width=4) (actual time=0.001..0.002 rows=0 loops=22474)

  • Index Cond: ($3 = id)
  • Filter: (trans_id = $2)
0.000 0.000 ↓ 0.0 0 1

Seq Scan on yearend (cost=0.00..36.55 rows=9 width=4) (actual time=0.000..0.000 rows=0 loops=1)

  • Filter: ((taxdate >= '2011-01-01'::date) AND (taxdate <= '2011-01-31'::date))
13.347 13.347 ↑ 1.0 1 4449

Index Scan using chart_id_key on chart c (cost=0.00..5.45 rows=1 width=72) (actual time=0.002..0.003 rows=1 loops=4449)

  • Index Cond: (c.id = "outer".chart_id)
  • Filter: ((category = 'I'::bpchar) OR (category = 'E'::bpchar))
3.673 3.673 ↓ 0.0 0 3673

Index Scan using translation_trans_id_key on translation l (cost=0.00..19.55 rows=1 width=36) (actual time=0.001..0.001 rows=0 loops=3673)

  • Index Cond: (l.trans_id = "outer".id)
  • Filter: ((language_code)::text = ''::text)
77.133 77.133 ↑ 1.0 76 3673

Seq Scan on department d (cost=0.00..1.76 rows=76 width=4) (actual time=0.001..0.021 rows=76 loops=3673)

80.806 80.806 ↑ 1.0 76 3673

Seq Scan on department t (cost=0.00..1.76 rows=76 width=4) (actual time=0.001..0.022 rows=76 loops=3673)

         

SubPlan (forNested Loop)

837.444 837.444 ↑ 1.0 1 279148

Index Scan using invoice_pkey on invoice iii (cost=0.00..3.39 rows=1 width=4) (actual time=0.002..0.003 rows=1 loops=279148)

  • Index Cond: ($3 = id)
  • Filter: (trans_id = $2)
0.001 0.509 ↓ 0.0 0 1

Subquery Scan "*SELECT* 2" (cost=85128.60..85128.61 rows=1 width=108) (actual time=0.509..0.509 rows=0 loops=1)

0.002 0.508 ↓ 0.0 0 1

HashAggregate (cost=85128.60..85128.60 rows=1 width=108) (actual time=0.508..0.508 rows=0 loops=1)

0.000 0.506 ↓ 0.0 0 1

Nested Loop (cost=0.00..85128.59 rows=1 width=108) (actual time=0.506..0.506 rows=0 loops=1)

  • Join Filter: ((((subplan))::numeric = ("inner".id)::numeric) OR (("outer".department_id)::numeric = ("inner".id)::numeric))
0.001 0.506 ↓ 0.0 0 1

Nested Loop Left Join (cost=0.00..84867.64 rows=1 width=120) (actual time=0.506..0.506 rows=0 loops=1)

  • Join Filter: ("inner".id = "outer".department_id)
0.001 0.505 ↓ 0.0 0 1

Nested Loop Left Join (cost=0.00..84864.93 rows=1 width=120) (actual time=0.505..0.505 rows=0 loops=1)

0.001 0.504 ↓ 0.0 0 1

Nested Loop (cost=0.00..84845.36 rows=1 width=92) (actual time=0.504..0.504 rows=0 loops=1)

  • Join Filter: ("outer".trans_id = "inner".trans_id)
0.000 0.503 ↓ 0.0 0 1

Nested Loop (cost=0.00..84596.24 rows=5 width=96) (actual time=0.503..0.503 rows=0 loops=1)

0.007 0.503 ↓ 0.0 0 1

Nested Loop (cost=0.00..84551.42 rows=9 width=92) (actual time=0.503..0.503 rows=0 loops=1)

0.312 0.312 ↑ 1.1 8 1

Index Scan using chart_id_key on chart c (cost=0.00..28.48 rows=9 width=72) (actual time=0.126..0.312 rows=8 loops=1)

  • Filter: (category = 'Q'::bpchar)
0.171 0.184 ↓ 0.0 0 8

Index Scan using acc_trans_chart_id_key on acc_trans ac (cost=0.00..9391.41 rows=2 width=24) (actual time=0.023..0.023 rows=0 loops=8)

  • Index Cond: ("outer".id = ac.chart_id)
  • Filter: ((taxdate < '2011-01-31'::date) AND ((((subplan))::numeric = 39920::numeric) OR ((department_id)::numeric = 39920::numeric)))
         

SubPlan (forIndex Scan)

0.013 0.013 ↓ 0.0 0 13

Index Scan using invoice_pkey on invoice ii (cost=0.00..3.39 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=13)

  • Index Cond: ($1 = id)
  • Filter: (trans_id = $0)
0.000 0.000 ↓ 0.0 0

Index Scan using gl_id_key on gl a (cost=0.00..4.97 rows=1 width=4) (actual time=.. rows= loops=0)

  • Index Cond: ("outer".trans_id = a.id)
0.000 0.000 ↓ 0.0 0

Seq Scan on yearend y (cost=0.00..27.70 rows=1770 width=4) (actual time=.. rows= loops=0)

0.000 0.000 ↓ 0.0 0

Index Scan using translation_trans_id_key on translation l (cost=0.00..19.55 rows=1 width=36) (actual time=.. rows= loops=0)

  • Index Cond: (l.trans_id = "outer".id)
  • Filter: ((language_code)::text = ''::text)
0.000 0.000 ↓ 0.0 0

Seq Scan on department d (cost=0.00..1.76 rows=76 width=4) (actual time=.. rows= loops=0)

0.000 0.000 ↓ 0.0 0

Seq Scan on department t (cost=0.00..1.76 rows=76 width=4) (actual time=.. rows= loops=0)

         

SubPlan (forNested Loop)

0.000 0.000 ↓ 0.0 0

Index Scan using invoice_pkey on invoice iii (cost=0.00..3.39 rows=1 width=4) (actual time=.. rows= loops=0)

  • Index Cond: ($1 = id)
  • Filter: (trans_id = $0)