explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 0oFc

Settings
# exclusive inclusive rows x rows loops node
1. 0.199 43,567.228 ↓ 118.0 236 1

Limit (cost=19,218.31..32,705.40 rows=2 width=482) (actual time=914.415..43,567.228 rows=236 loops=1)

  • Output: ks.id, ks.storecode, ks.storename, psa.orgname, psa.orgstructid, st.dickey, st.dicvalue, sl.dickey, sl.dicvalue, cc.id, cc.channelcode, cc.channelname, cc.supplier, cpsa.orgstructid, cpsa.orgname, cpsa.codepath, kcdc.id, kcdc.cashtime, kcdc.tn_cashdate, (CASE WHEN (kcdc.tn_cashtype = 1) THEN '现金'::text WHEN (kcdc.tn_cashtype = 2) THEN '货补'::text ELSE '其他'::text END), kcdc.total, (CASE WHEN (kcdc.tn_cashtype = 2) THEN kcdc.tn_cashamount WHEN (kcdc.tn_cashtype = 1) THEN kcdc.tn_cashamount ELSE '0'::numeric END), ((SubPlan 1))
2. 1.893 43,567.029 ↓ 118.0 236 1

Result (cost=19,218.31..32,705.40 rows=2 width=482) (actual time=914.414..43,567.029 rows=236 loops=1)

  • Output: ks.id, ks.storecode, ks.storename, psa.orgname, psa.orgstructid, st.dickey, st.dicvalue, sl.dickey, sl.dicvalue, cc.id, cc.channelcode, cc.channelname, cc.supplier, cpsa.orgstructid, cpsa.orgname, cpsa.codepath, kcdc.id, kcdc.cashtime, kcdc.tn_cashdate, (CASE WHEN (kcdc.tn_cashtype = 1) THEN '现金'::text WHEN (kcdc.tn_cashtype = 2) THEN '货补'::text ELSE '其他'::text END), kcdc.total, (CASE WHEN (kcdc.tn_cashtype = 2) THEN kcdc.tn_cashamount WHEN (kcdc.tn_cashtype = 1) THEN kcdc.tn_cashamount ELSE '0'::numeric END), (SubPlan 1)
3. 0.633 534.076 ↓ 118.0 236 1

Sort (cost=19,218.31..19,218.31 rows=2 width=450) (actual time=533.835..534.076 rows=236 loops=1)

  • Output: ks.id, ks.storecode, ks.storename, psa.orgname, psa.orgstructid, st.dickey, st.dicvalue, sl.dickey, sl.dicvalue, cc.id, cc.channelcode, cc.channelname, cc.supplier, cpsa.orgstructid, cpsa.orgname, cpsa.codepath, kcdc.id, kcdc.cashtime, kcdc.tn_cashdate, (CASE WHEN (kcdc.tn_cashtype = 1) THEN '现金'::text WHEN (kcdc.tn_cashtype = 2) THEN '货补'::text ELSE '其他'::text END), kcdc.total, (CASE WHEN (kcdc.tn_cashtype = 2) THEN kcdc.tn_cashamount WHEN (kcdc.tn_cashtype = 1) THEN kcdc.tn_cashamount ELSE '0'::numeric END)
  • Sort Key: kcdc.cashtime DESC
  • Sort Method: quicksort Memory: 237kB
4. 7.338 533.443 ↓ 118.0 236 1

Nested Loop Left Join (cost=7,291.51..19,218.30 rows=2 width=450) (actual time=391.960..533.443 rows=236 loops=1)

  • Output: ks.id, ks.storecode, ks.storename, psa.orgname, psa.orgstructid, st.dickey, st.dicvalue, sl.dickey, sl.dicvalue, cc.id, cc.channelcode, cc.channelname, cc.supplier, cpsa.orgstructid, cpsa.orgname, cpsa.codepath, kcdc.id, kcdc.cashtime, kcdc.tn_cashdate, CASE WHEN (kcdc.tn_cashtype = 1) THEN '现金'::text WHEN (kcdc.tn_cashtype = 2) THEN '货补'::text ELSE '其他'::text END, kcdc.total, CASE WHEN (kcdc.tn_cashtype = 2) THEN kcdc.tn_cashamount WHEN (kcdc.tn_cashtype = 1) THEN kcdc.tn_cashamount ELSE '0'::numeric END
  • Join Filter: (sl.dickey = ks.storelevel)
  • Rows Removed by Join Filter: 74,812
5. 7.255 521.385 ↓ 118.0 236 1

Nested Loop Left Join (cost=7,291.51..19,194.97 rows=2 width=382) (actual time=391.913..521.385 rows=236 loops=1)

  • Output: kcdc.id, kcdc.cashtime, kcdc.tn_cashdate, kcdc.tn_cashtype, kcdc.total, kcdc.tn_cashamount, ks.id, ks.storecode, ks.storename, ks.storelevel, psa.orgname, psa.orgstructid, st.dickey, st.dicvalue, cc.id, cc.channelcode, cc.channelname, cc.supplier, cpsa.orgstructid, cpsa.orgname, cpsa.codepath
  • Join Filter: (st.dickey = ks.storetype)
  • Rows Removed by Join Filter: 74,812
6. 0.132 509.410 ↓ 118.0 236 1

Nested Loop Left Join (cost=7,291.51..19,171.66 rows=2 width=369) (actual time=391.848..509.410 rows=236 loops=1)

  • Output: kcdc.id, kcdc.cashtime, kcdc.tn_cashdate, kcdc.tn_cashtype, kcdc.total, kcdc.tn_cashamount, ks.id, ks.storecode, ks.storename, ks.storetype, ks.storelevel, psa.orgname, psa.orgstructid, cc.id, cc.channelcode, cc.channelname, cc.supplier, cpsa.orgstructid, cpsa.orgname, cpsa.codepath
  • Inner Unique: true
7. 0.273 508.570 ↓ 118.0 236 1

Nested Loop Left Join (cost=7,291.22..19,171.03 rows=2 width=359) (actual time=391.839..508.570 rows=236 loops=1)

  • Output: kcdc.id, kcdc.cashtime, kcdc.tn_cashdate, kcdc.tn_cashtype, kcdc.total, kcdc.tn_cashamount, ks.id, ks.storecode, ks.storename, ks.seleareaid, ks.storetype, ks.storelevel, cc.id, cc.channelcode, cc.channelname, cc.supplier, cpsa.orgstructid, cpsa.orgname, cpsa.codepath
  • Inner Unique: true
8. 0.283 477.853 ↓ 118.0 236 1

Nested Loop Left Join (cost=7,290.79..19,154.14 rows=2 width=304) (actual time=391.826..477.853 rows=236 loops=1)

  • Output: kcdc.id, kcdc.cashtime, kcdc.tn_cashdate, kcdc.tn_cashtype, kcdc.total, kcdc.tn_cashamount, kcdc.tn_customerid, cc.id, cc.channelcode, cc.channelname, cc.supplier, cpsa.orgstructid, cpsa.orgname, cpsa.codepath
  • Join Filter: (cc.id = kcdc.channelid)
9. 267.959 477.570 ↓ 118.0 236 1

Bitmap Heap Scan on public.kx_cost_display_cash kcdc (cost=7,290.22..19,137.49 rows=2 width=50) (actual time=391.791..477.570 rows=236 loops=1)

  • Output: kcdc.platcreatetime, kcdc.platupdatetime, kcdc.platcreateop, kcdc.platupdateop, kcdc.platstatus, kcdc.id, kcdc.execid, kcdc.costid, kcdc.displaytype, kcdc.productinfo, kcdc.photo, kcdc.total, kcdc.tn_cashamount, kcdc.tn_cashtype, kcdc.tn_signature, kcdc.tn_remark, kcdc.tn_cashdate, kcdc.tn_customerid, kcdc.tn_vstatus, kcdc.createop, kcdc.cashtime, kcdc.tn_applyid, kcdc.customer_check, kcdc.channelid
  • Recheck Cond: (kcdc.costid = '1300365132085465088'::bigint)
  • Filter: ((kcdc.channelid = '6515543727'::bigint) AND (kcdc.tn_vstatus = 0) AND (kcdc.platstatus = 1))
  • Rows Removed by Filter: 4,698
  • Heap Blocks: exact=2,938
10. 209.611 209.611 ↓ 1.1 5,551 1

Bitmap Index Scan on kx_cost_display_cash_tn_customerid_idx (cost=0.00..7,290.22 rows=5,244 width=0) (actual time=209.611..209.611 rows=5,551 loops=1)

  • Index Cond: (kcdc.costid = '1300365132085465088'::bigint)
11. 0.000 0.000 ↑ 1.0 1 236

Materialize (cost=0.57..16.62 rows=1 width=262) (actual time=0.000..0.000 rows=1 loops=236)

  • Output: cc.id, cc.channelcode, cc.channelname, cc.supplier, cpsa.orgstructid, cpsa.orgname, cpsa.codepath
12. 0.005 0.028 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.57..16.62 rows=1 width=262) (actual time=0.027..0.028 rows=1 loops=1)

  • Output: cc.id, cc.channelcode, cc.channelname, cc.supplier, cpsa.orgstructid, cpsa.orgname, cpsa.codepath
  • Inner Unique: true
13. 0.013 0.013 ↑ 1.0 1 1

Index Scan using ka_kq_channelcustomers_pkey on public.ka_kq_channelcustomers cc (cost=0.29..8.31 rows=1 width=144) (actual time=0.012..0.013 rows=1 loops=1)

  • Output: cc.platcreatetime, cc.platupdatetime, cc.platcreateop, cc.platupdateop, cc.platstatus, cc.channelcode, cc.channelname, cc.saleareaid, cc.contactname, cc.contactphone, cc.contactposition, cc.regionid, cc.address, cc.officephone, cc.fax, cc.email, cc.cooperationtime, cc.remark, cc.status, cc.superiorcustomer, cc.recentvisittime, cc.brand, cc.category, cc.supplier, cc.bizmanager, cc.id, cc.channeltype, cc.customertype, cc.createtime, cc.updatetime, cc.createop, cc.updateop, cc.validlocationstatus, cc.superiorcustomername, cc.supplymode, cc.disabletime, cc.maxaccountnum, cc.cooperativestatus, cc.ishaveadmiaccount, cc.approvestatus, cc.approvetime, cc.tn_collectioncustomers, cc.kxsaleareaid, cc.k3code, cc.tn_kxsaleareaid, cc.iscost, cc.areaids
  • Index Cond: (cc.id = '6515543727'::bigint)
  • Filter: (cc.platstatus = 1)
14. 0.010 0.010 ↑ 1.0 1 1

Index Scan using ix_pl_orgstruct_orgstructid on public.pl_orgstruct cpsa (cost=0.29..8.31 rows=1 width=126) (actual time=0.010..0.010 rows=1 loops=1)

  • Output: cpsa.orgstructid, cpsa.parentorgstructid, cpsa.orgname, cpsa.status, cpsa.orgstructeffecttime, cpsa.orgstructexpiretime, cpsa.orgstructtypeid, cpsa.userinfoid, cpsa.positionid, cpsa.parentpositionid, cpsa.orgid, cpsa.orgtypeid, cpsa.orgstructdescr, cpsa.codepath, cpsa.createtime, cpsa.createop, cpsa.updatetime, cpsa.updateop, cpsa.fullname, cpsa.seq, cpsa.platcreatetime, cpsa.platupdatetime, cpsa.platcreateop, cpsa.platupdateop, cpsa.platstatus, cpsa.level, cpsa.parentmemberid
  • Index Cond: (cpsa.orgstructid = cc.saleareaid)
  • Filter: (cpsa.platstatus = 1)
15. 30.444 30.444 ↑ 1.0 1 236

Index Scan using kx_kq_store_pkey on public.kx_kq_store ks (cost=0.42..8.45 rows=1 width=63) (actual time=0.129..0.129 rows=1 loops=236)

  • Output: ks.id, ks.storecode, ks.storename, ks.seleareaid, ks.storetype, ks.storelevel
  • Index Cond: (ks.id = kcdc.tn_customerid)
  • Filter: (ks.platstatus = 1)
16. 0.708 0.708 ↑ 1.0 1 236

Index Scan using ix_pl_orgstruct_orgstructid on public.pl_orgstruct psa (cost=0.29..0.31 rows=1 width=18) (actual time=0.003..0.003 rows=1 loops=236)

  • Output: psa.orgstructid, psa.parentorgstructid, psa.orgname, psa.status, psa.orgstructeffecttime, psa.orgstructexpiretime, psa.orgstructtypeid, psa.userinfoid, psa.positionid, psa.parentpositionid, psa.orgid, psa.orgtypeid, psa.orgstructdescr, psa.codepath, psa.createtime, psa.createop, psa.updatetime, psa.updateop, psa.fullname, psa.seq, psa.platcreatetime, psa.platupdatetime, psa.platcreateop, psa.platupdateop, psa.platstatus, psa.level, psa.parentmemberid
  • Index Cond: (psa.orgstructid = ks.seleareaid)
  • Filter: (psa.platstatus = 1)
17. 4.600 4.720 ↑ 1.0 318 236

Materialize (cost=0.00..14.56 rows=318 width=21) (actual time=0.000..0.020 rows=318 loops=236)

  • Output: st.dickey, st.dicvalue
18. 0.120 0.120 ↑ 1.0 318 1

Seq Scan on public.pl_dictionary st (cost=0.00..12.97 rows=318 width=21) (actual time=0.007..0.120 rows=318 loops=1)

  • Output: st.dickey, st.dicvalue
  • Filter: (st.platstatus = 1)
19. 4.595 4.720 ↑ 1.0 318 236

Materialize (cost=0.00..14.56 rows=318 width=21) (actual time=0.000..0.020 rows=318 loops=236)

  • Output: sl.dickey, sl.dicvalue
20. 0.125 0.125 ↑ 1.0 318 1

Seq Scan on public.pl_dictionary sl (cost=0.00..12.97 rows=318 width=21) (actual time=0.003..0.125 rows=318 loops=1)

  • Output: sl.dickey, sl.dicvalue
  • Filter: (sl.platstatus = 1)
21.          

SubPlan (for Result)

22. 2.596 43,031.060 ↑ 1.0 1 236

Aggregate (cost=6,743.51..6,743.52 rows=1 width=32) (actual time=182.335..182.335 rows=1 loops=236)

  • Output: string_agg(((p.product)::character varying)::text, ','::text)
23. 1.652 43,028.464 ↑ 1.0 1 236

Nested Loop (cost=0.42..6,743.50 rows=1 width=8) (actual time=167.101..182.324 rows=1 loops=236)

  • Output: p.product
24. 332.760 332.760 ↑ 1.0 1 236

Index Scan using pk_kx_cost_display_cash_1 on public.kx_cost_display_cash c (cost=0.42..8.44 rows=1 width=8) (actual time=1.408..1.410 rows=1 loops=236)

  • Output: c.platcreatetime, c.platupdatetime, c.platcreateop, c.platupdateop, c.platstatus, c.id, c.execid, c.costid, c.displaytype, c.productinfo, c.photo, c.total, c.tn_cashamount, c.tn_cashtype, c.tn_signature, c.tn_remark, c.tn_cashdate, c.tn_customerid, c.tn_vstatus, c.createop, c.cashtime, c.tn_applyid, c.customer_check, c.channelid
  • Index Cond: (c.id = kcdc.id)
  • Filter: (c.platstatus = 1)
25. 42,694.052 42,694.052 ↑ 1.0 1 236

Seq Scan on public.kx_cost_display_cash_displayproduct p (cost=0.00..6,735.05 rows=1 width=16) (actual time=165.687..180.907 rows=1 loops=236)

  • Output: p.platcreatetime, p.platupdatetime, p.platcreateop, p.platupdateop, p.platstatus, p.id, p.cashid, p.display, p.product, p.number, p.price
  • Filter: ((p.cashid = kcdc.id) AND (p.platstatus = 1))
  • Rows Removed by Filter: 230,043