explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ktw1

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Limit (cost=13.62..13.63 rows=1 width=12) (actual rows= loops=)

  • Output: vc_2.status, vc_2.updatetime
2. 0.000 0.000 ↓ 0.0

Sort (cost=13.62..13.63 rows=1 width=12) (actual rows= loops=)

  • Output: vc_2.status, vc_2.updatetime
  • Sort Key: vc_2.updatetime DESC
3. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on public.kx_visit_customerstatus vc_2 (cost=9.59..13.61 rows=1 width=12) (actual rows= loops=)

  • Output: vc_2.status, vc_2.updatetime
  • Recheck Cond: ((vc_2.customerid = p.customerid) AND (vc_2.userid = p.userid))
  • Filter: ((vc_2.visitdate >= '2020-05-19'::date) AND (vc_2.visitdate <= '2020-05-19'::date) AND (vc_2.customertype = p.customertype) AND (vc_2.platstatus = 1))
4. 0.000 0.000 ↓ 0.0

BitmapAnd (cost=9.59..9.59 rows=1 width=0) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_kx_visit_customerstatus_customerid (cost=0.00..4.32 rows=3 width=0) (actual rows= loops=)

  • Index Cond: (vc_2.customerid = p.customerid)
6. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_kx_visit_customerstatus_userid (cost=0.00..5.02 rows=97 width=0) (actual rows= loops=)

  • Index Cond: (vc_2.userid = p.userid)
7. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 2 (cost=242.56..126,773.53 rows=8 width=242) (actual rows= loops=)

  • Output: "*SELECT* 2".customerid, "*SELECT* 2".customername, "*SELECT* 2".ctype, "*SELECT* 2".customerlevel, "*SELECT* 2".address, "*SELECT* 2".customerstatus, "*SELECT* 2".plandate, "*SELECT* 2".userid, "*SELECT* 2".customertype, 0, "*SELECT* 2".actualvisittime, "*SELECT* 2".visittype, "*SELECT* 2".status, 2
8. 0.000 0.000 ↓ 0.0

Nested Loop (cost=242.56..126,773.43 rows=8 width=238) (actual rows= loops=)

  • Output: "*SELECT* 1_1".id, "*SELECT* 1_1".customername, "*SELECT* 1_1".store_channeltype, "*SELECT* 1_1".storelevelname, "*SELECT* 1_1".address, "*SELECT* 1_1".status, p_1.actualvisitdate, p_1.userid, p_1.customertype, 0, p_1.actualvisittime, p_1.visittype, (SubPlan 1), 2
9. 0.000 0.000 ↓ 0.0

Nested Loop Anti Join (cost=21.38..26.77 rows=1 width=38) (actual rows= loops=)

  • Output: p_1.actualvisitdate, p_1.userid, p_1.customertype, p_1.actualvisittime, p_1.visittype, p_1.customerid
  • Join Filter: ((kx_visit_planvisit.userid = p_1.userid) AND (kx_visit_planvisit.customerid = p_1.customerid))
10. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on public.kx_visit_actual p_1 (cost=21.38..25.40 rows=1 width=38) (actual rows= loops=)

  • Output: p_1.platcreatetime, p_1.platupdatetime, p_1.platcreateop, p_1.platupdateop, p_1.platstatus, p_1.actualvisitid, p_1.actualvisitdate, p_1.userid, p_1.customerid, p_1.visittype, p_1.actualvisittime, p_1.customertype
  • Recheck Cond: ((p_1.actualvisitdate >= '2020-05-19'::date) AND (p_1.actualvisitdate <= '2020-05-19'::date) AND (p_1.userid = '1211917550779240448'::bigint))
  • Filter: (p_1.platstatus = 1)
11. 0.000 0.000 ↓ 0.0

BitmapAnd (cost=21.38..21.38 rows=1 width=0) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_kx_visit_actual_actualvisitdate (cost=0.00..10.52 rows=223 width=0) (actual rows= loops=)

  • Index Cond: ((p_1.actualvisitdate >= '2020-05-19'::date) AND (p_1.actualvisitdate <= '2020-05-19'::date))
13. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_kx_visit_actual_userid (cost=0.00..10.60 rows=308 width=0) (actual rows= loops=)

  • Index Cond: (p_1.userid = '1211917550779240448'::bigint)
14. 0.000 0.000 ↓ 0.0

Seq Scan on public.kx_visit_planvisit (cost=0.00..1.36 rows=1 width=16) (actual rows= loops=)

  • Output: kx_visit_planvisit.platcreatetime, kx_visit_planvisit.platupdatetime, kx_visit_planvisit.platcreateop, kx_visit_planvisit.platupdateop, kx_visit_planvisit.platstatus, kx_visit_planvisit.planid, kx_visit_planvisit.plandate, kx_visit_planvisit.userid, kx_visit_planvisit.account, kx_visit_planvisit.customerid, kx_visit_planvisit.customertype, kx_visit_planvisit.seq, kx_visit_planvisit.status, kx_visit_planvisit.tn_source
  • Filter: ((kx_visit_planvisit.plandate >= '2020-05-19'::date) AND (kx_visit_planvisit.plandate <= '2020-05-19'::date) AND (kx_visit_planvisit.userid = '1211917550779240448'::bigint) AND (kx_visit_planvisit.platstatus = 1))
15. 0.000 0.000 ↓ 0.0

Append (cost=221.18..126,637.63 rows=3 width=196) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 1_1 (cost=221.18..126,115.73 rows=1 width=196) (actual rows= loops=)

  • Output: "*SELECT* 1_1".id, "*SELECT* 1_1".customername, "*SELECT* 1_1".store_channeltype, "*SELECT* 1_1".storelevelname, "*SELECT* 1_1".address, "*SELECT* 1_1".status
  • Filter: (p_1.customerid = "*SELECT* 1_1".id)
17. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=221.18..123,944.70 rows=173,682 width=1,672) (actual rows= loops=)

  • Output: ks_1.id, NULL::character varying(200), ks_1.storename, NULL::character varying(200), NULL::bigint, NULL::character varying(1000), f_sfa_split_salearea(ps_2.fullname, 3, 1), NULL::character varying, pd2_1.dicvalue, pd3_1.dicvalue, NULL::bigint, ks_1.status, ks_1.address, NULL::bigint, NULL::bigint, NULL::timestamp(0) without time zone, NULL::timestamp(0) without time zone, NULL::integer, NULL::bigint
  • Hash Cond: (ks_1.storelevel = pd3_1.dickey)
18. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=183.26..79,834.97 rows=173,682 width=256) (actual rows= loops=)

  • Output: ks_1.id, ks_1.storename, ks_1.status, ks_1.address, ks_1.storelevel, ps_2.fullname, pd2_1.dicvalue
  • Hash Cond: (ks_1.storetype = pd2_1.dickey)
19. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=145.34..77,408.92 rows=173,682 width=250) (actual rows= loops=)

  • Output: ks_1.id, ks_1.storename, ks_1.status, ks_1.address, ks_1.storetype, ks_1.storelevel, ps_2.fullname
  • Hash Cond: (ks_1.channeltype = pd1_2.dickey)
20. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=107.42..74,982.87 rows=173,682 width=258) (actual rows= loops=)

  • Output: ks_1.id, ks_1.storename, ks_1.status, ks_1.address, ks_1.channeltype, ks_1.storetype, ks_1.storelevel, ps_2.fullname
  • Inner Unique: true
  • Hash Cond: (ks_1.seleareaid = ps_2.orgstructid)
21. 0.000 0.000 ↓ 0.0

Seq Scan on public.kx_kq_store ks_1 (cost=0.00..74,418.43 rows=173,682 width=200) (actual rows= loops=)

  • Output: ks_1.platcreatetime, ks_1.platupdatetime, ks_1.platcreateop, ks_1.platupdateop, ks_1.platstatus, ks_1.id, ks_1.storecode, ks_1.storename, ks_1.storeshortname, ks_1.seleareaid, ks_1.channeltype, ks_1.storetype, ks_1.storelevel, ks_1.contactname, ks_1.contactphone, ks_1.contactposition, ks_1.address, ks_1.regionid, ks_1.officephone, ks_1.iskeystore, ks_1.remark, ks_1.status, ks_1.longitude, ks_1.latitude, ks_1.presentative, ks_1.brand, ks_1.category, ks_1.supplier, ks_1.recentvisittime, ks_1.supplymode, ks_1.kaid, ks_1.customertype, ks_1.createop, ks_1.createtime, ks_1.updatetime, ks_1.updateop, ks_1.isvalidaddress, ks_1.validlocationstatus, ks_1.kaname, ks_1.disabletime, ks_1.approvestatus, ks_1.auto_tags, ks_1.manual_tags, ks_1.distributor, ks_1.pmmrepresentative, ks_1.approvetime, ks_1.kxsaleareaid, ks_1.isself, ks_1.tn_iskastore, ks_1.tn_erp_systemcode, ks_1.tn_historycode, ks_1.tn_isdirectsale, ks_1.tn_recenthelpvisittime, ks_1.tn_locationtype, ks_1.tn_storearea, ks_1.tn_displaypic, ks_1.tn_gatepic, ks_1.tn_approval_comments
  • Filter: ((ks_1.platstatus = 1) AND ((ks_1.customertype = '905324680615956480'::bigint) OR (ks_1.customertype = '905324761813487616'::bigint)))
22. 0.000 0.000 ↓ 0.0

Hash (cost=85.52..85.52 rows=1,752 width=74) (actual rows= loops=)

  • Output: ps_2.fullname, ps_2.orgstructid
  • Buckets: 2048 Batches: 1 Memory Usage: 87kB
23. 0.000 0.000 ↓ 0.0

Seq Scan on public.pl_orgstruct ps_2 (cost=0.00..85.52 rows=1,752 width=74) (actual rows= loops=)

  • Output: ps_2.fullname, ps_2.orgstructid
24. 0.000 0.000 ↓ 0.0

Hash (cost=28.52..28.52 rows=752 width=8) (actual rows= loops=)

  • Output: pd1_2.dickey
  • Buckets: 1024 Batches: 1 Memory Usage: 37kB
25. 0.000 0.000 ↓ 0.0

Seq Scan on public.pl_dictionary pd1_2 (cost=0.00..28.52 rows=752 width=8) (actual rows= loops=)

  • Output: pd1_2.dickey
26. 0.000 0.000 ↓ 0.0

Hash (cost=28.52..28.52 rows=752 width=22) (actual rows= loops=)

  • Output: pd2_1.dicvalue, pd2_1.dickey
  • Buckets: 1024 Batches: 1 Memory Usage: 50kB
27. 0.000 0.000 ↓ 0.0

Seq Scan on public.pl_dictionary pd2_1 (cost=0.00..28.52 rows=752 width=22) (actual rows= loops=)

  • Output: pd2_1.dicvalue, pd2_1.dickey
28. 0.000 0.000 ↓ 0.0

Hash (cost=28.52..28.52 rows=752 width=22) (actual rows= loops=)

  • Output: pd3_1.dicvalue, pd3_1.dickey
  • Buckets: 1024 Batches: 1 Memory Usage: 50kB
29. 0.000 0.000 ↓ 0.0

Seq Scan on public.pl_dictionary pd3_1 (cost=0.00..28.52 rows=752 width=22) (actual rows= loops=)

  • Output: pd3_1.dicvalue, pd3_1.dickey
30. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 2_2 (cost=145.34..513.73 rows=1 width=215) (actual rows= loops=)

  • Output: "*SELECT* 2_2".id, "*SELECT* 2_2".customername, "*SELECT* 2_2".store_channeltype, "*SELECT* 2_2".storelevelname, "*SELECT* 2_2".address, "*SELECT* 2_2".status
  • Filter: (p_1.customerid = "*SELECT* 2_2".id)
31. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=145.34..504.10 rows=770 width=1,691) (actual rows= loops=)

  • Output: kc_1.id, NULL::character varying(200), kc_1.channelname, NULL::character varying(200), NULL::bigint, NULL::character varying(1000), f_sfa_split_salearea(ps_3.fullname, 3, 1), NULL::character varying, pd1_3.dicvalue, ''::character varying, NULL::bigint, kc_1.status, kc_1.address, NULL::bigint, NULL::bigint, NULL::timestamp(0) without time zone, NULL::timestamp(0) without time zone, NULL::integer, NULL::bigint
  • Hash Cond: (kc_1.channeltype = pd1_3.dickey)
32. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=107.42..264.92 rows=770 width=243) (actual rows= loops=)

  • Output: kc_1.id, kc_1.channelname, kc_1.status, kc_1.address, kc_1.channeltype, ps_3.fullname
  • Inner Unique: true
  • Hash Cond: (kc_1.saleareaid = ps_3.orgstructid)
33. 0.000 0.000 ↓ 0.0

Seq Scan on public.ka_kq_channelcustomers kc_1 (cost=0.00..155.47 rows=770 width=185) (actual rows= loops=)

  • Output: kc_1.platcreatetime, kc_1.platupdatetime, kc_1.platcreateop, kc_1.platupdateop, kc_1.platstatus, kc_1.channelcode, kc_1.channelname, kc_1.saleareaid, kc_1.contactname, kc_1.contactphone, kc_1.contactposition, kc_1.regionid, kc_1.address, kc_1.officephone, kc_1.fax, kc_1.email, kc_1.cooperationtime, kc_1.remark, kc_1.status, kc_1.superiorcustomer, kc_1.recentvisittime, kc_1.brand, kc_1.category, kc_1.supplier, kc_1.bizmanager, kc_1.id, kc_1.channeltype, kc_1.customertype, kc_1.createtime, kc_1.updatetime, kc_1.createop, kc_1.updateop, kc_1.validlocationstatus, kc_1.superiorcustomername, kc_1.supplymode, kc_1.disabletime, kc_1.maxaccountnum, kc_1.cooperativestatus, kc_1.ishaveadmiaccount, kc_1.approvestatus, kc_1.approvetime, kc_1.kxsaleareaid, kc_1.channel_archives_id, kc_1.channel_operatorinfo_id, kc_1.authorizationinfo_id, kc_1.channel_addressinfo_id
  • Filter: ((kc_1.platstatus = 1) AND ((kc_1.customertype = '905324680615956480'::bigint) OR (kc_1.customertype = '905324761813487616'::bigint)))
34. 0.000 0.000 ↓ 0.0

Hash (cost=85.52..85.52 rows=1,752 width=74) (actual rows= loops=)

  • Output: ps_3.fullname, ps_3.orgstructid
  • Buckets: 2048 Batches: 1 Memory Usage: 87kB
35. 0.000 0.000 ↓ 0.0

Seq Scan on public.pl_orgstruct ps_3 (cost=0.00..85.52 rows=1,752 width=74) (actual rows= loops=)

  • Output: ps_3.fullname, ps_3.orgstructid
36. 0.000 0.000 ↓ 0.0

Hash (cost=28.52..28.52 rows=752 width=22) (actual rows= loops=)

  • Output: pd1_3.dicvalue, pd1_3.dickey
  • Buckets: 1024 Batches: 1 Memory Usage: 50kB
37. 0.000 0.000 ↓ 0.0

Seq Scan on public.pl_dictionary pd1_3 (cost=0.00..28.52 rows=752 width=22) (actual rows= loops=)

  • Output: pd1_3.dicvalue, pd1_3.dickey
38. 0.000 0.000 ↓ 0.0

Index Scan using kx_kq_ka_pkey on public.kx_kq_ka ka_1 (cost=0.14..8.17 rows=1 width=91) (actual rows= loops=)

  • Output: ka_1.id, ka_1.kasystemname, ''::character varying, ''::character varying, ka_1.address, ka_1.status
  • Index Cond: (ka_1.id = p_1.customerid)
  • Filter: ((ka_1.platstatus = 1) AND ((ka_1.customertype = '905324680615956480'::bigint) OR (ka_1.customertype = '905324761813487616'::bigint)))
39.          

SubPlan (for Nested Loop)

40. 0.000 0.000 ↓ 0.0

Limit (cost=13.62..13.63 rows=1 width=12) (actual rows= loops=)

  • Output: vc_1.status, vc_1.updatetime
41. 0.000 0.000 ↓ 0.0

Sort (cost=13.62..13.63 rows=1 width=12) (actual rows= loops=)

  • Output: vc_1.status, vc_1.updatetime
  • Sort Key: vc_1.updatetime DESC
42. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on public.kx_visit_customerstatus vc_1 (cost=9.59..13.61 rows=1 width=12) (actual rows= loops=)

  • Output: vc_1.status, vc_1.updatetime
  • Recheck Cond: ((vc_1.customerid = p_1.customerid) AND (vc_1.userid = p_1.userid))
  • Filter: ((vc_1.visitdate >= '2020-05-19'::date) AND (vc_1.visitdate <= '2020-05-19'::date) AND (vc_1.customertype = p_1.customertype) AND (vc_1.platstatus = 1))
43. 0.000 0.000 ↓ 0.0

BitmapAnd (cost=9.59..9.59 rows=1 width=0) (actual rows= loops=)

44. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_kx_visit_customerstatus_customerid (cost=0.00..4.32 rows=3 width=0) (actual rows= loops=)

  • Index Cond: (vc_1.customerid = p_1.customerid)
45. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx_kx_visit_customerstatus_userid (cost=0.00..5.02 rows=97 width=0) (actual rows= loops=)

  • Index Cond: (vc_1.userid = p_1.userid)