GaussDB(DWS)性能调优:实时场景下的性能跳变问题案例

举报
O泡果奶~ 发表于 2023/08/24 15:10:24 2023/08/24
【摘要】 实时场景中,存在着性能跳变问题(即原本执行时间在秒级或是分钟级的语句突然执行不出来),该案例主要针对这一类问题利用hint中的enable_index_nestloop参数进行分析解决

1、【问题描述】

该问题发生在实时场景下,语句执行时间因为达到了 3600s而自动终止运行,导致影响业务进度。

2、【原始语句】

WITH recp_coa AS (
    -- 01分库海外子公司
    SELECT
        /*+parallel(8)*/
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        l.coa_company_code || '.' || l.coa_bu_code || '.' || l.coa_geo_pc_code || '.' || l.coa_department_code || '.' || l.coa_account_code || '.' || l.coa_product_code || '.' || l.coa_ic_code AS coa,
        COUNT(1)
    FROM
        SDIFIN.OGG_HAR_RECEIPT_8660_VI recp
        INNER JOIN SDIFIN.OGG_HAR_REC_HISTORY_8660_VI recph 
         ON recp.RECEIPT_ID = recph.RECEIPT_ID
        INNER JOIN SDIFIN.OGG_HAR_RECEIPT_DISTR_8660_VI dis 
         ON recph.RECEIPT_HISTORY_ID = dis.SOURCE_REFERENCE_ID
        INNER JOIN SDIFIN.OGG_HAH_AE_LINE_LINK_T_8663 lk 
         ON to_char(dis.receipt_distribution_id) = lk.source_distribution_id_char_1
         AND lk.application_code = 'AR'
         AND lk.event_type_code IN ('RECP_CREATE', 'MISC_RECP_CREATE')
        INNER JOIN SDIFIN.OGG_HAH_AE_LINE_T_8663 l 
         ON lk.ae_header_id = l.ae_header_id
         AND l.ACCOUNTING_CLASS_CODE IN ('CASH','MISC_CASH','CONFIRMATION')
         AND l.ledger_short_name NOT LIKE '%LOCAL'
    WHERE
        1 = 1
        AND   ( recp.unit_code  IN  ('1421','1241','0311','0021') )  
        AND  recp.gl_date between '2023-07-01 00:00:00' and '2023-07-28 23:59:59' 
        AND  1=1 
        AND   ( recp.salesperson_name  IN  ('F03201A20Argentina','F60001A20Paraguay','F85801A20Uruguay','F07605A20 Brazil Curitiba','F07606A20 Brazil Recife','F07601A20Brazil Main Office','F07602A20Sao Paulo','F07603A20Rio De Janeiro','F07604A20Brasilia','F07607A20Brazil Manaus','F17001A20Colombia','F21801A20Ecuador','F12401A20Canada','F09201A20Virgin Islands British','F09201A20Virgin Islands, British','F66001A20Anguilla','F02801A20Antigua and Barbuda','F53301A20Aruba','F04401A20Bahamas','F05201A20Barbados','F08401A20Belize','F06001A20Bermuda','F13601A20Cayman Islands','F21201A20Dominica','F18801A20Costa Rica','F21401A20Dominican','F30801A20Grenada','F31201A20Guadeloupe','F32801A20Guyana','F33201A20Haiti','F32001A20Guatemala','F34001A20Honduras','F38801A20Jamaica','F50001A20Montserrat','F53001A20Netherlands Antilles','F59101A20Panama','F55801A20Nicaragua','F63001A20Puerto Rico','F65901A20Saint Kitts and Nevis','F61201A20Cayman Islands','F62010A20French Guiana','F62102A20Virgin Islands, U.S.','F62102A20Martinique','F66201A20Saint Lucia','F67001A20Saint Vincent& the Grenadines','F22201A20Salvador','F74001A20Suriname','F78001A20Trinidad and Tobago','F79601A20Turks and Caicos Islands','F86201A20Venezuela','F62110A20Saint Barthelemy','F62310A20Aruba','F84001A20USA','F84001B20USA','F85101A20U.S.A. Eastern Office','F85201A20U.S.A. Central Office','F85301A20U.S.A. Western Office','F85501A20AT&T Key Account Dept','F85601A20U.S.A. Sprint Account Dept','F85701A20VRZ Key Account Dept','F85901A20T-Mobile Key Account Dept','F86101A20MSO Key Account Dept','F60401A20Peru','F48401A20Mexico','F48401B20Mexico','F06801A20Bolivia','F15201A20Chile','F07601A20Brazil') )  
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND   ( l.coa_account_code  IN  ('9999900','9999989','9999950','9999951') )  
    GROUP BY
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        l.coa_company_code || '.' || l.coa_bu_code || '.' || l.coa_geo_pc_code || '.' || l.coa_department_code || '.' || l.coa_account_code || '.' || l.coa_product_code || '.' || l.coa_ic_code
    UNION ALL
    -- 02分库国内子公司
    SELECT
        /*+parallel(8)*/
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        l.coa_company_code || '.' || l.coa_bu_code || '.' || l.coa_geo_pc_code || '.' || l.coa_department_code || '.' || l.coa_account_code || '.' || l.coa_product_code || '.' || l.coa_ic_code AS coa,
        COUNT(1)
    FROM
        SDIFIN.OGG_HAR_RECEIPT_8660_VI recp
        INNER JOIN SDIFIN.OGG_HAR_REC_HISTORY_8660_VI recph 
         ON recp.RECEIPT_ID = recph.RECEIPT_ID
        INNER JOIN SDIFIN.OGG_HAR_RECEIPT_DISTR_8660_VI dis 
         ON recph.RECEIPT_HISTORY_ID = dis.SOURCE_REFERENCE_ID
        INNER JOIN SDIFIN.OGG_HAH_AE_LINE_LINK_02_8663 lk 
         ON to_char(dis.receipt_distribution_id) = lk.source_distribution_id_char_1
         AND lk.application_code = 'AR'
         AND lk.event_type_code IN ('RECP_CREATE', 'MISC_RECP_CREATE')
        INNER JOIN SDIFIN.OGG_HAH_AE_LINE_02_8663 l 
         ON lk.ae_header_id = l.ae_header_id
         AND l.ACCOUNTING_CLASS_CODE IN ('CASH', 'MISC_CASH','CONFIRMATION')
         AND l.ledger_short_name NOT LIKE '%LOCAL'
    WHERE
        1 = 1
        AND   ( recp.unit_code  IN  ('1421','1241','0311','0021') )  
        AND  recp.gl_date between '2023-07-01 00:00:00' and '2023-07-28 23:59:59' 
        AND  1=1 
        AND   ( recp.salesperson_name  IN  ('F03201A20Argentina','F60001A20Paraguay','F85801A20Uruguay','F07605A20 Brazil Curitiba','F07606A20 Brazil Recife','F07601A20Brazil Main Office','F07602A20Sao Paulo','F07603A20Rio De Janeiro','F07604A20Brasilia','F07607A20Brazil Manaus','F17001A20Colombia','F21801A20Ecuador','F12401A20Canada','F09201A20Virgin Islands British','F09201A20Virgin Islands, British','F66001A20Anguilla','F02801A20Antigua and Barbuda','F53301A20Aruba','F04401A20Bahamas','F05201A20Barbados','F08401A20Belize','F06001A20Bermuda','F13601A20Cayman Islands','F21201A20Dominica','F18801A20Costa Rica','F21401A20Dominican','F30801A20Grenada','F31201A20Guadeloupe','F32801A20Guyana','F33201A20Haiti','F32001A20Guatemala','F34001A20Honduras','F38801A20Jamaica','F50001A20Montserrat','F53001A20Netherlands Antilles','F59101A20Panama','F55801A20Nicaragua','F63001A20Puerto Rico','F65901A20Saint Kitts and Nevis','F61201A20Cayman Islands','F62010A20French Guiana','F62102A20Virgin Islands, U.S.','F62102A20Martinique','F66201A20Saint Lucia','F67001A20Saint Vincent& the Grenadines','F22201A20Salvador','F74001A20Suriname','F78001A20Trinidad and Tobago','F79601A20Turks and Caicos Islands','F86201A20Venezuela','F62110A20Saint Barthelemy','F62310A20Aruba','F84001A20USA','F84001B20USA','F85101A20U.S.A. Eastern Office','F85201A20U.S.A. Central Office','F85301A20U.S.A. Western Office','F85501A20AT&T Key Account Dept','F85601A20U.S.A. Sprint Account Dept','F85701A20VRZ Key Account Dept','F85901A20T-Mobile Key Account Dept','F86101A20MSO Key Account Dept','F60401A20Peru','F48401A20Mexico','F48401B20Mexico','F06801A20Bolivia','F15201A20Chile','F07601A20Brazil') )  
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND   ( l.coa_account_code  IN  ('9999900','9999989','9999950','9999951') )  
    GROUP BY
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        l.coa_company_code || '.' || l.coa_bu_code || '.' || l.coa_geo_pc_code || '.' || l.coa_department_code || '.' || l.coa_account_code || '.' || l.coa_product_code || '.' || l.coa_ic_code
    UNION ALL
    -- 03分库终端子公司
    SELECT
        /*+parallel(8)*/
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        l.coa_company_code || '.' || l.coa_bu_code || '.' || l.coa_geo_pc_code || '.' || l.coa_department_code || '.' || l.coa_account_code || '.' || l.coa_product_code || '.' || l.coa_ic_code AS coa,
        COUNT(1)
    FROM
        SDIFIN.OGG_HAR_RECEIPT_8660_VI recp
        INNER JOIN SDIFIN.OGG_HAR_REC_HISTORY_8660_VI recph 
         ON recp.RECEIPT_ID = recph.RECEIPT_ID
        INNER JOIN SDIFIN.OGG_HAR_RECEIPT_DISTR_8660_VI dis 
         ON recph.RECEIPT_HISTORY_ID = dis.SOURCE_REFERENCE_ID
        INNER JOIN SDIFIN.OGG_HAH_AE_LINE_LINK_03_8663 lk 
         ON to_char(dis.receipt_distribution_id) = lk.source_distribution_id_char_1
         AND lk.application_code = 'AR'
         AND lk.event_type_code IN ('RECP_CREATE', 'MISC_RECP_CREATE')
        INNER JOIN SDIFIN.OGG_HAH_AE_LINE_03_8663 l
         ON lk.ae_header_id = l.ae_header_id
         AND l.ACCOUNTING_CLASS_CODE IN ('CASH', 'MISC_CASH','CONFIRMATION')
         AND l.ledger_short_name NOT LIKE '%LOCAL'
    WHERE
        1 = 1
        AND   ( recp.unit_code  IN  ('1421','1241','0311','0021') )  
        AND  recp.gl_date between '2023-07-01 00:00:00' and '2023-07-28 23:59:59' 
        AND  1=1 
        AND   ( recp.salesperson_name  IN  ('F03201A20Argentina','F60001A20Paraguay','F85801A20Uruguay','F07605A20 Brazil Curitiba','F07606A20 Brazil Recife','F07601A20Brazil Main Office','F07602A20Sao Paulo','F07603A20Rio De Janeiro','F07604A20Brasilia','F07607A20Brazil Manaus','F17001A20Colombia','F21801A20Ecuador','F12401A20Canada','F09201A20Virgin Islands British','F09201A20Virgin Islands, British','F66001A20Anguilla','F02801A20Antigua and Barbuda','F53301A20Aruba','F04401A20Bahamas','F05201A20Barbados','F08401A20Belize','F06001A20Bermuda','F13601A20Cayman Islands','F21201A20Dominica','F18801A20Costa Rica','F21401A20Dominican','F30801A20Grenada','F31201A20Guadeloupe','F32801A20Guyana','F33201A20Haiti','F32001A20Guatemala','F34001A20Honduras','F38801A20Jamaica','F50001A20Montserrat','F53001A20Netherlands Antilles','F59101A20Panama','F55801A20Nicaragua','F63001A20Puerto Rico','F65901A20Saint Kitts and Nevis','F61201A20Cayman Islands','F62010A20French Guiana','F62102A20Virgin Islands, U.S.','F62102A20Martinique','F66201A20Saint Lucia','F67001A20Saint Vincent& the Grenadines','F22201A20Salvador','F74001A20Suriname','F78001A20Trinidad and Tobago','F79601A20Turks and Caicos Islands','F86201A20Venezuela','F62110A20Saint Barthelemy','F62310A20Aruba','F84001A20USA','F84001B20USA','F85101A20U.S.A. Eastern Office','F85201A20U.S.A. Central Office','F85301A20U.S.A. Western Office','F85501A20AT&T Key Account Dept','F85601A20U.S.A. Sprint Account Dept','F85701A20VRZ Key Account Dept','F85901A20T-Mobile Key Account Dept','F86101A20MSO Key Account Dept','F60401A20Peru','F48401A20Mexico','F48401B20Mexico','F06801A20Bolivia','F15201A20Chile','F07601A20Brazil') )  
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND   ( l.coa_account_code  IN  ('9999900','9999989','9999950','9999951') )  
    GROUP BY
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        l.coa_company_code || '.' || l.coa_bu_code || '.' || l.coa_geo_pc_code || '.' || l.coa_department_code || '.' || l.coa_account_code || '.' || l.coa_product_code || '.' || l.coa_ic_code
    UNION ALL
    -- 04分库云子公司
    SELECT
        /*+parallel(8)*/
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        l.coa_company_code || '.' || l.coa_bu_code || '.' || l.coa_geo_pc_code || '.' || l.coa_department_code || '.' || l.coa_account_code || '.' || l.coa_product_code || '.' || l.coa_ic_code AS coa,
        COUNT(1)
    FROM
        SDIFIN.OGG_HAR_RECEIPT_8660_VI recp
        INNER JOIN SDIFIN.OGG_HAR_REC_HISTORY_8660_VI recph 
         ON recp.RECEIPT_ID = recph.RECEIPT_ID
        INNER JOIN SDIFIN.OGG_HAR_RECEIPT_DISTR_8660_VI dis 
         ON recph.RECEIPT_HISTORY_ID = dis.SOURCE_REFERENCE_ID
        INNER JOIN SDIFIN.OGG_HAH_AE_LINE_LINK_04_8663 lk 
         ON to_char(dis.receipt_distribution_id) = lk.source_distribution_id_char_1
         AND lk.application_code = 'AR'
         AND lk.event_type_code IN ('RECP_CREATE', 'MISC_RECP_CREATE')
        INNER JOIN SDIFIN.OGG_HAH_AE_LINE_04_8663 l 
         ON lk.ae_header_id = l.ae_header_id
         AND l.ACCOUNTING_CLASS_CODE IN ('CASH', 'MISC_CASH','CONFIRMATION')
         AND l.ledger_short_name NOT LIKE '%LOCAL'
    WHERE
        1 = 1
        AND   ( recp.unit_code  IN  ('1421','1241','0311','0021') )  
        AND  recp.gl_date between '2023-07-01 00:00:00' and '2023-07-28 23:59:59' 
        AND  1=1 
        AND   ( recp.salesperson_name  IN  ('F03201A20Argentina','F60001A20Paraguay','F85801A20Uruguay','F07605A20 Brazil Curitiba','F07606A20 Brazil Recife','F07601A20Brazil Main Office','F07602A20Sao Paulo','F07603A20Rio De Janeiro','F07604A20Brasilia','F07607A20Brazil Manaus','F17001A20Colombia','F21801A20Ecuador','F12401A20Canada','F09201A20Virgin Islands British','F09201A20Virgin Islands, British','F66001A20Anguilla','F02801A20Antigua and Barbuda','F53301A20Aruba','F04401A20Bahamas','F05201A20Barbados','F08401A20Belize','F06001A20Bermuda','F13601A20Cayman Islands','F21201A20Dominica','F18801A20Costa Rica','F21401A20Dominican','F30801A20Grenada','F31201A20Guadeloupe','F32801A20Guyana','F33201A20Haiti','F32001A20Guatemala','F34001A20Honduras','F38801A20Jamaica','F50001A20Montserrat','F53001A20Netherlands Antilles','F59101A20Panama','F55801A20Nicaragua','F63001A20Puerto Rico','F65901A20Saint Kitts and Nevis','F61201A20Cayman Islands','F62010A20French Guiana','F62102A20Virgin Islands, U.S.','F62102A20Martinique','F66201A20Saint Lucia','F67001A20Saint Vincent& the Grenadines','F22201A20Salvador','F74001A20Suriname','F78001A20Trinidad and Tobago','F79601A20Turks and Caicos Islands','F86201A20Venezuela','F62110A20Saint Barthelemy','F62310A20Aruba','F84001A20USA','F84001B20USA','F85101A20U.S.A. Eastern Office','F85201A20U.S.A. Central Office','F85301A20U.S.A. Western Office','F85501A20AT&T Key Account Dept','F85601A20U.S.A. Sprint Account Dept','F85701A20VRZ Key Account Dept','F85901A20T-Mobile Key Account Dept','F86101A20MSO Key Account Dept','F60401A20Peru','F48401A20Mexico','F48401B20Mexico','F06801A20Bolivia','F15201A20Chile','F07601A20Brazil') )  
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND   ( l.coa_account_code  IN  ('9999900','9999989','9999950','9999951') )  
    GROUP BY
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        l.coa_company_code || '.' || l.coa_bu_code || '.' || l.coa_geo_pc_code || '.' || l.coa_department_code || '.' || l.coa_account_code || '.' || l.coa_product_code || '.' || l.coa_ic_code
      UNION ALL 
    -- 05切换前数据
    SELECT
        /*+parallel(8)*/
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        '' AS coa,
        COUNT(1)
    FROM
        SDIFIN.OGG_HAR_RECEIPT_8660_VI recp
        INNER JOIN SDIFIN.OGG_HAR_REC_HISTORY_8660_VI recph 
         ON recp.RECEIPT_ID = recph.RECEIPT_ID
        INNER JOIN SDIFIN.OGG_HAR_RECEIPT_DISTR_8660_VI dis 
         ON recph.RECEIPT_HISTORY_ID = dis.SOURCE_REFERENCE_ID
         AND dis.DESCRIPTION ='ERP项目'
    WHERE
        1 = 1
        AND   ( recp.unit_code  IN  ('1421','1241','0311','0021') )  
        AND  recp.gl_date between '2023-07-01 00:00:00' and '2023-07-28 23:59:59' 
        AND  1=1 
        AND   ( recp.salesperson_name  IN  ('F03201A20Argentina','F60001A20Paraguay','F85801A20Uruguay','F07605A20 Brazil Curitiba','F07606A20 Brazil Recife','F07601A20Brazil Main Office','F07602A20Sao Paulo','F07603A20Rio De Janeiro','F07604A20Brasilia','F07607A20Brazil Manaus','F17001A20Colombia','F21801A20Ecuador','F12401A20Canada','F09201A20Virgin Islands British','F09201A20Virgin Islands, British','F66001A20Anguilla','F02801A20Antigua and Barbuda','F53301A20Aruba','F04401A20Bahamas','F05201A20Barbados','F08401A20Belize','F06001A20Bermuda','F13601A20Cayman Islands','F21201A20Dominica','F18801A20Costa Rica','F21401A20Dominican','F30801A20Grenada','F31201A20Guadeloupe','F32801A20Guyana','F33201A20Haiti','F32001A20Guatemala','F34001A20Honduras','F38801A20Jamaica','F50001A20Montserrat','F53001A20Netherlands Antilles','F59101A20Panama','F55801A20Nicaragua','F63001A20Puerto Rico','F65901A20Saint Kitts and Nevis','F61201A20Cayman Islands','F62010A20French Guiana','F62102A20Virgin Islands, U.S.','F62102A20Martinique','F66201A20Saint Lucia','F67001A20Saint Vincent& the Grenadines','F22201A20Salvador','F74001A20Suriname','F78001A20Trinidad and Tobago','F79601A20Turks and Caicos Islands','F86201A20Venezuela','F62110A20Saint Barthelemy','F62310A20Aruba','F84001A20USA','F84001B20USA','F85101A20U.S.A. Eastern Office','F85201A20U.S.A. Central Office','F85301A20U.S.A. Western Office','F85501A20AT&T Key Account Dept','F85601A20U.S.A. Sprint Account Dept','F85701A20VRZ Key Account Dept','F85901A20T-Mobile Key Account Dept','F86101A20MSO Key Account Dept','F60401A20Peru','F48401A20Mexico','F48401B20Mexico','F06801A20Bolivia','F15201A20Chile','F07601A20Brazil') )  
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
    GROUP BY
        recp.RECEIPT_ID,
        recph.REVERSE_DATE
)
SELECT
    /*+parallel(8)*/
    DISTINCT recp2.unit_code AS 账套,
    recp2.salesperson_name AS salesreps,
    recp2.receipt_number AS 收据号,
    nvl(recp_coa.coa, NULL) AS coa,
    recp2.receipt_method_name AS name,
    recp2.receipt_type AS TYPE,
    substr(recp_coa.coa, 10, 4) AS region,
    recp2.status AS 当前票据状态,
    recp2.account_number AS 客户代码,
    recp2.bp_name AS PARTY_NAME,
    recp2.comments,
    to_char(recp2.receipt_date, 'yyyy/mm/dd') AS receipt_date,
    recp2.currency_code AS 币种,
    recp2.total_amount AS amount,
    recp2.functional_total_amount AS REC_AMOUT_LC,
    recp2.NET_AMOUNT AS net_amount,
    recp2.FUNCTIONAL_NET_AMOUNT AS net_amount_lc,
    nvl(recp2.charges_amount, 0) AS bank_charge,
    recp2.exchange_rate_value AS exchange_rate,
    to_char(recp2.exchange_rate_date, 'yyyy/mm/dd') AS exchange_date,
    recp2.exchange_rate_type,
    recp2.issue_name,
    to_char(recp2.issue_date, 'yyyy/mm/dd') AS issue_date,
    to_char(recp2.gl_date, 'yyyy/mm/dd') AS gl_date,
    recp2.customer_serial_number AS customer_receipt_reference,
    to_char(recp_coa.reverse_date, 'yyyy/mm/dd') AS reversal_date,
    recp2.bank_name AS bank_account_name,
    recp2.bank_account_no AS bank_account_num,
    fuser.lname AS user_name,
    recp2.creation_date,
    recp2.document_no AS document_num
FROM
    recp_coa,
    SDIFIN.OGG_HAR_RECEIPT_8660_VI recp2,
    SDIIT.OGG_TPL_USER_T_8667 fuser
WHERE
    recp_coa.RECEIPT_ID = recp2.RECEIPT_ID
    AND recp2.CREATED_BY = fuser.USER_ID(+)

3、【性能分析】:

分析该语句的执行计划,发现该语句在运行到 id=117 时一直收不到结果,进一步分析发现该算子下层存在 id=129 的 Nest Loop 算子,同时看出该算子下的内表数据行数明显大于外表数据行数,怀疑是NestLoop使用场景不对导致影响语句的执行性能。

如上图所示,lk表为内表,l表为驱动表(外表)

补充(NestLoop算子及其适用场景)

  • NestLoop就是扫描一个表(外表),每读到一条记录,就根据Join字段上的索引去另一张表(内表)里面查找,若Join字段上没有索引查询优化器一般就不会选择 NestLoop。在NestLoop中,内表(一般是带索引的大表)被外表(也叫“驱动表”,一般为小表)驱动,外表返回的每一行都要在内表中检索找到与它匹配的行,因此整个查询返回的结果集不能太大。NestLoop适用于结果集很小,并且内表在Join字段上建有索引。
  • 如何选择驱动表(外表)两个表做嵌套循环,驱动表的选择很重要,如果选择大表作为驱动表,大表中的每一条数据都需要全表扫描内表一次,相比小表作为驱动表来说,性能大大下降。
  • 嵌套循环的使用场景:
    (1)驱动表的结果集小(应用过自己的查询条件后),选择驱动表非常重要。
    (2)内表的连接列上有索引。
    (3)驱动表和内表连接匹配的数据量小,即扫描内表连接列的索引的次数少。

因此,大致可以判断该语句执行性能下降的原因是:l表作为驱动表(外表)数据行数大于lk这个内表,l表要多次访问lk表,导致语句执行时间过长进而影响性能

针对发现的问题进行调优解决:在语句执行过程中,避免使用NestLoop算子,可以通过下面这条语句实现

set global(enable_index_nestloop off)

补充(enable_index_nestloop)

其用于控制优化器对内表参数化索引扫描嵌套循环连接规划类型的使用。

set enable_index_nestloop = off;
WITH recp_coa AS (
    -- 01分库海外子公司
    SELECT
        /*+parallel(8)*/
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        l.coa_company_code || '.' || l.coa_bu_code || '.' || l.coa_geo_pc_code || '.' || l.coa_department_code || '.' || l.coa_account_code || '.' || l.coa_product_code || '.' || l.coa_ic_code AS coa,
        COUNT(1)
    FROM
        SDIFIN.OGG_HAR_RECEIPT_8660_VI recp
        INNER JOIN SDIFIN.OGG_HAR_REC_HISTORY_8660_VI recph 
         ON recp.RECEIPT_ID = recph.RECEIPT_ID
        INNER JOIN SDIFIN.OGG_HAR_RECEIPT_DISTR_8660_VI dis 
         ON recph.RECEIPT_HISTORY_ID = dis.SOURCE_REFERENCE_ID
        INNER JOIN SDIFIN.OGG_HAH_AE_LINE_LINK_T_8663 lk 
         ON to_char(dis.receipt_distribution_id) = lk.source_distribution_id_char_1
         AND lk.application_code = 'AR'
         AND lk.event_type_code IN ('RECP_CREATE', 'MISC_RECP_CREATE')
        INNER JOIN SDIFIN.OGG_HAH_AE_LINE_T_8663 l 
         ON lk.ae_header_id = l.ae_header_id
         AND l.ACCOUNTING_CLASS_CODE IN ('CASH','MISC_CASH','CONFIRMATION')
         AND l.ledger_short_name NOT LIKE '%LOCAL'
    WHERE
        1 = 1
        AND   ( recp.unit_code  IN  ('1421','1241','0311','0021') )  
        AND  recp.gl_date between '2023-07-01 00:00:00' and '2023-07-28 23:59:59' 
        AND  1=1 
        AND   ( recp.salesperson_name  IN  ('F03201A20Argentina','F60001A20Paraguay','F85801A20Uruguay','F07605A20 Brazil Curitiba','F07606A20 Brazil Recife','F07601A20Brazil Main Office','F07602A20Sao Paulo','F07603A20Rio De Janeiro','F07604A20Brasilia','F07607A20Brazil Manaus','F17001A20Colombia','F21801A20Ecuador','F12401A20Canada','F09201A20Virgin Islands British','F09201A20Virgin Islands, British','F66001A20Anguilla','F02801A20Antigua and Barbuda','F53301A20Aruba','F04401A20Bahamas','F05201A20Barbados','F08401A20Belize','F06001A20Bermuda','F13601A20Cayman Islands','F21201A20Dominica','F18801A20Costa Rica','F21401A20Dominican','F30801A20Grenada','F31201A20Guadeloupe','F32801A20Guyana','F33201A20Haiti','F32001A20Guatemala','F34001A20Honduras','F38801A20Jamaica','F50001A20Montserrat','F53001A20Netherlands Antilles','F59101A20Panama','F55801A20Nicaragua','F63001A20Puerto Rico','F65901A20Saint Kitts and Nevis','F61201A20Cayman Islands','F62010A20French Guiana','F62102A20Virgin Islands, U.S.','F62102A20Martinique','F66201A20Saint Lucia','F67001A20Saint Vincent& the Grenadines','F22201A20Salvador','F74001A20Suriname','F78001A20Trinidad and Tobago','F79601A20Turks and Caicos Islands','F86201A20Venezuela','F62110A20Saint Barthelemy','F62310A20Aruba','F84001A20USA','F84001B20USA','F85101A20U.S.A. Eastern Office','F85201A20U.S.A. Central Office','F85301A20U.S.A. Western Office','F85501A20AT&T Key Account Dept','F85601A20U.S.A. Sprint Account Dept','F85701A20VRZ Key Account Dept','F85901A20T-Mobile Key Account Dept','F86101A20MSO Key Account Dept','F60401A20Peru','F48401A20Mexico','F48401B20Mexico','F06801A20Bolivia','F15201A20Chile','F07601A20Brazil') )  
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND   ( l.coa_account_code  IN  ('9999900','9999989','9999950','9999951') )  
    GROUP BY
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        l.coa_company_code || '.' || l.coa_bu_code || '.' || l.coa_geo_pc_code || '.' || l.coa_department_code || '.' || l.coa_account_code || '.' || l.coa_product_code || '.' || l.coa_ic_code
    UNION ALL
    -- 02分库国内子公司
    SELECT
        /*+parallel(8)*/
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        l.coa_company_code || '.' || l.coa_bu_code || '.' || l.coa_geo_pc_code || '.' || l.coa_department_code || '.' || l.coa_account_code || '.' || l.coa_product_code || '.' || l.coa_ic_code AS coa,
        COUNT(1)
    FROM
        SDIFIN.OGG_HAR_RECEIPT_8660_VI recp
        INNER JOIN SDIFIN.OGG_HAR_REC_HISTORY_8660_VI recph 
         ON recp.RECEIPT_ID = recph.RECEIPT_ID
        INNER JOIN SDIFIN.OGG_HAR_RECEIPT_DISTR_8660_VI dis 
         ON recph.RECEIPT_HISTORY_ID = dis.SOURCE_REFERENCE_ID
        INNER JOIN SDIFIN.OGG_HAH_AE_LINE_LINK_02_8663 lk 
         ON to_char(dis.receipt_distribution_id) = lk.source_distribution_id_char_1
         AND lk.application_code = 'AR'
         AND lk.event_type_code IN ('RECP_CREATE', 'MISC_RECP_CREATE')
        INNER JOIN SDIFIN.OGG_HAH_AE_LINE_02_8663 l 
         ON lk.ae_header_id = l.ae_header_id
         AND l.ACCOUNTING_CLASS_CODE IN ('CASH', 'MISC_CASH','CONFIRMATION')
         AND l.ledger_short_name NOT LIKE '%LOCAL'
    WHERE
        1 = 1
        AND   ( recp.unit_code  IN  ('1421','1241','0311','0021') )  
        AND  recp.gl_date between '2023-07-01 00:00:00' and '2023-07-28 23:59:59' 
        AND  1=1 
        AND   ( recp.salesperson_name  IN  ('F03201A20Argentina','F60001A20Paraguay','F85801A20Uruguay','F07605A20 Brazil Curitiba','F07606A20 Brazil Recife','F07601A20Brazil Main Office','F07602A20Sao Paulo','F07603A20Rio De Janeiro','F07604A20Brasilia','F07607A20Brazil Manaus','F17001A20Colombia','F21801A20Ecuador','F12401A20Canada','F09201A20Virgin Islands British','F09201A20Virgin Islands, British','F66001A20Anguilla','F02801A20Antigua and Barbuda','F53301A20Aruba','F04401A20Bahamas','F05201A20Barbados','F08401A20Belize','F06001A20Bermuda','F13601A20Cayman Islands','F21201A20Dominica','F18801A20Costa Rica','F21401A20Dominican','F30801A20Grenada','F31201A20Guadeloupe','F32801A20Guyana','F33201A20Haiti','F32001A20Guatemala','F34001A20Honduras','F38801A20Jamaica','F50001A20Montserrat','F53001A20Netherlands Antilles','F59101A20Panama','F55801A20Nicaragua','F63001A20Puerto Rico','F65901A20Saint Kitts and Nevis','F61201A20Cayman Islands','F62010A20French Guiana','F62102A20Virgin Islands, U.S.','F62102A20Martinique','F66201A20Saint Lucia','F67001A20Saint Vincent& the Grenadines','F22201A20Salvador','F74001A20Suriname','F78001A20Trinidad and Tobago','F79601A20Turks and Caicos Islands','F86201A20Venezuela','F62110A20Saint Barthelemy','F62310A20Aruba','F84001A20USA','F84001B20USA','F85101A20U.S.A. Eastern Office','F85201A20U.S.A. Central Office','F85301A20U.S.A. Western Office','F85501A20AT&T Key Account Dept','F85601A20U.S.A. Sprint Account Dept','F85701A20VRZ Key Account Dept','F85901A20T-Mobile Key Account Dept','F86101A20MSO Key Account Dept','F60401A20Peru','F48401A20Mexico','F48401B20Mexico','F06801A20Bolivia','F15201A20Chile','F07601A20Brazil') )  
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND   ( l.coa_account_code  IN  ('9999900','9999989','9999950','9999951') )  
    GROUP BY
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        l.coa_company_code || '.' || l.coa_bu_code || '.' || l.coa_geo_pc_code || '.' || l.coa_department_code || '.' || l.coa_account_code || '.' || l.coa_product_code || '.' || l.coa_ic_code
    UNION ALL
    -- 03分库终端子公司
    SELECT
        /*+parallel(8)*/
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        l.coa_company_code || '.' || l.coa_bu_code || '.' || l.coa_geo_pc_code || '.' || l.coa_department_code || '.' || l.coa_account_code || '.' || l.coa_product_code || '.' || l.coa_ic_code AS coa,
        COUNT(1)
    FROM
        SDIFIN.OGG_HAR_RECEIPT_8660_VI recp
        INNER JOIN SDIFIN.OGG_HAR_REC_HISTORY_8660_VI recph 
         ON recp.RECEIPT_ID = recph.RECEIPT_ID
        INNER JOIN SDIFIN.OGG_HAR_RECEIPT_DISTR_8660_VI dis 
         ON recph.RECEIPT_HISTORY_ID = dis.SOURCE_REFERENCE_ID
        INNER JOIN SDIFIN.OGG_HAH_AE_LINE_LINK_03_8663 lk 
         ON to_char(dis.receipt_distribution_id) = lk.source_distribution_id_char_1
         AND lk.application_code = 'AR'
         AND lk.event_type_code IN ('RECP_CREATE', 'MISC_RECP_CREATE')
        INNER JOIN SDIFIN.OGG_HAH_AE_LINE_03_8663 l
         ON lk.ae_header_id = l.ae_header_id
         AND l.ACCOUNTING_CLASS_CODE IN ('CASH', 'MISC_CASH','CONFIRMATION')
         AND l.ledger_short_name NOT LIKE '%LOCAL'
    WHERE
        1 = 1
        AND   ( recp.unit_code  IN  ('1421','1241','0311','0021') )  
        AND  recp.gl_date between '2023-07-01 00:00:00' and '2023-07-28 23:59:59' 
        AND  1=1 
        AND   ( recp.salesperson_name  IN  ('F03201A20Argentina','F60001A20Paraguay','F85801A20Uruguay','F07605A20 Brazil Curitiba','F07606A20 Brazil Recife','F07601A20Brazil Main Office','F07602A20Sao Paulo','F07603A20Rio De Janeiro','F07604A20Brasilia','F07607A20Brazil Manaus','F17001A20Colombia','F21801A20Ecuador','F12401A20Canada','F09201A20Virgin Islands British','F09201A20Virgin Islands, British','F66001A20Anguilla','F02801A20Antigua and Barbuda','F53301A20Aruba','F04401A20Bahamas','F05201A20Barbados','F08401A20Belize','F06001A20Bermuda','F13601A20Cayman Islands','F21201A20Dominica','F18801A20Costa Rica','F21401A20Dominican','F30801A20Grenada','F31201A20Guadeloupe','F32801A20Guyana','F33201A20Haiti','F32001A20Guatemala','F34001A20Honduras','F38801A20Jamaica','F50001A20Montserrat','F53001A20Netherlands Antilles','F59101A20Panama','F55801A20Nicaragua','F63001A20Puerto Rico','F65901A20Saint Kitts and Nevis','F61201A20Cayman Islands','F62010A20French Guiana','F62102A20Virgin Islands, U.S.','F62102A20Martinique','F66201A20Saint Lucia','F67001A20Saint Vincent& the Grenadines','F22201A20Salvador','F74001A20Suriname','F78001A20Trinidad and Tobago','F79601A20Turks and Caicos Islands','F86201A20Venezuela','F62110A20Saint Barthelemy','F62310A20Aruba','F84001A20USA','F84001B20USA','F85101A20U.S.A. Eastern Office','F85201A20U.S.A. Central Office','F85301A20U.S.A. Western Office','F85501A20AT&T Key Account Dept','F85601A20U.S.A. Sprint Account Dept','F85701A20VRZ Key Account Dept','F85901A20T-Mobile Key Account Dept','F86101A20MSO Key Account Dept','F60401A20Peru','F48401A20Mexico','F48401B20Mexico','F06801A20Bolivia','F15201A20Chile','F07601A20Brazil') )  
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND   ( l.coa_account_code  IN  ('9999900','9999989','9999950','9999951') )  
    GROUP BY
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        l.coa_company_code || '.' || l.coa_bu_code || '.' || l.coa_geo_pc_code || '.' || l.coa_department_code || '.' || l.coa_account_code || '.' || l.coa_product_code || '.' || l.coa_ic_code
    UNION ALL
    -- 04分库云子公司
    SELECT
        /*+parallel(8)*/
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        l.coa_company_code || '.' || l.coa_bu_code || '.' || l.coa_geo_pc_code || '.' || l.coa_department_code || '.' || l.coa_account_code || '.' || l.coa_product_code || '.' || l.coa_ic_code AS coa,
        COUNT(1)
    FROM
        SDIFIN.OGG_HAR_RECEIPT_8660_VI recp
        INNER JOIN SDIFIN.OGG_HAR_REC_HISTORY_8660_VI recph 
         ON recp.RECEIPT_ID = recph.RECEIPT_ID
        INNER JOIN SDIFIN.OGG_HAR_RECEIPT_DISTR_8660_VI dis 
         ON recph.RECEIPT_HISTORY_ID = dis.SOURCE_REFERENCE_ID
        INNER JOIN SDIFIN.OGG_HAH_AE_LINE_LINK_04_8663 lk 
         ON to_char(dis.receipt_distribution_id) = lk.source_distribution_id_char_1
         AND lk.application_code = 'AR'
         AND lk.event_type_code IN ('RECP_CREATE', 'MISC_RECP_CREATE')
        INNER JOIN SDIFIN.OGG_HAH_AE_LINE_04_8663 l 
         ON lk.ae_header_id = l.ae_header_id
         AND l.ACCOUNTING_CLASS_CODE IN ('CASH', 'MISC_CASH','CONFIRMATION')
         AND l.ledger_short_name NOT LIKE '%LOCAL'
    WHERE
        1 = 1
        AND   ( recp.unit_code  IN  ('1421','1241','0311','0021') )  
        AND  recp.gl_date between '2023-07-01 00:00:00' and '2023-07-28 23:59:59' 
        AND  1=1 
        AND   ( recp.salesperson_name  IN  ('F03201A20Argentina','F60001A20Paraguay','F85801A20Uruguay','F07605A20 Brazil Curitiba','F07606A20 Brazil Recife','F07601A20Brazil Main Office','F07602A20Sao Paulo','F07603A20Rio De Janeiro','F07604A20Brasilia','F07607A20Brazil Manaus','F17001A20Colombia','F21801A20Ecuador','F12401A20Canada','F09201A20Virgin Islands British','F09201A20Virgin Islands, British','F66001A20Anguilla','F02801A20Antigua and Barbuda','F53301A20Aruba','F04401A20Bahamas','F05201A20Barbados','F08401A20Belize','F06001A20Bermuda','F13601A20Cayman Islands','F21201A20Dominica','F18801A20Costa Rica','F21401A20Dominican','F30801A20Grenada','F31201A20Guadeloupe','F32801A20Guyana','F33201A20Haiti','F32001A20Guatemala','F34001A20Honduras','F38801A20Jamaica','F50001A20Montserrat','F53001A20Netherlands Antilles','F59101A20Panama','F55801A20Nicaragua','F63001A20Puerto Rico','F65901A20Saint Kitts and Nevis','F61201A20Cayman Islands','F62010A20French Guiana','F62102A20Virgin Islands, U.S.','F62102A20Martinique','F66201A20Saint Lucia','F67001A20Saint Vincent& the Grenadines','F22201A20Salvador','F74001A20Suriname','F78001A20Trinidad and Tobago','F79601A20Turks and Caicos Islands','F86201A20Venezuela','F62110A20Saint Barthelemy','F62310A20Aruba','F84001A20USA','F84001B20USA','F85101A20U.S.A. Eastern Office','F85201A20U.S.A. Central Office','F85301A20U.S.A. Western Office','F85501A20AT&T Key Account Dept','F85601A20U.S.A. Sprint Account Dept','F85701A20VRZ Key Account Dept','F85901A20T-Mobile Key Account Dept','F86101A20MSO Key Account Dept','F60401A20Peru','F48401A20Mexico','F48401B20Mexico','F06801A20Bolivia','F15201A20Chile','F07601A20Brazil') )  
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND   ( l.coa_account_code  IN  ('9999900','9999989','9999950','9999951') )  
    GROUP BY
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        l.coa_company_code || '.' || l.coa_bu_code || '.' || l.coa_geo_pc_code || '.' || l.coa_department_code || '.' || l.coa_account_code || '.' || l.coa_product_code || '.' || l.coa_ic_code
      UNION ALL 
    -- 05切换前数据
    SELECT
        /*+parallel(8)*/
        recp.RECEIPT_ID,
        recph.REVERSE_DATE,
        '' AS coa,
        COUNT(1)
    FROM
        SDIFIN.OGG_HAR_RECEIPT_8660_VI recp
        INNER JOIN SDIFIN.OGG_HAR_REC_HISTORY_8660_VI recph 
         ON recp.RECEIPT_ID = recph.RECEIPT_ID
        INNER JOIN SDIFIN.OGG_HAR_RECEIPT_DISTR_8660_VI dis 
         ON recph.RECEIPT_HISTORY_ID = dis.SOURCE_REFERENCE_ID
         AND dis.DESCRIPTION ='ERP项目'
    WHERE
        1 = 1
        AND   ( recp.unit_code  IN  ('1421','1241','0311','0021') )  
        AND  recp.gl_date between '2023-07-01 00:00:00' and '2023-07-28 23:59:59' 
        AND  1=1 
        AND   ( recp.salesperson_name  IN  ('F03201A20Argentina','F60001A20Paraguay','F85801A20Uruguay','F07605A20 Brazil Curitiba','F07606A20 Brazil Recife','F07601A20Brazil Main Office','F07602A20Sao Paulo','F07603A20Rio De Janeiro','F07604A20Brasilia','F07607A20Brazil Manaus','F17001A20Colombia','F21801A20Ecuador','F12401A20Canada','F09201A20Virgin Islands British','F09201A20Virgin Islands, British','F66001A20Anguilla','F02801A20Antigua and Barbuda','F53301A20Aruba','F04401A20Bahamas','F05201A20Barbados','F08401A20Belize','F06001A20Bermuda','F13601A20Cayman Islands','F21201A20Dominica','F18801A20Costa Rica','F21401A20Dominican','F30801A20Grenada','F31201A20Guadeloupe','F32801A20Guyana','F33201A20Haiti','F32001A20Guatemala','F34001A20Honduras','F38801A20Jamaica','F50001A20Montserrat','F53001A20Netherlands Antilles','F59101A20Panama','F55801A20Nicaragua','F63001A20Puerto Rico','F65901A20Saint Kitts and Nevis','F61201A20Cayman Islands','F62010A20French Guiana','F62102A20Virgin Islands, U.S.','F62102A20Martinique','F66201A20Saint Lucia','F67001A20Saint Vincent& the Grenadines','F22201A20Salvador','F74001A20Suriname','F78001A20Trinidad and Tobago','F79601A20Turks and Caicos Islands','F86201A20Venezuela','F62110A20Saint Barthelemy','F62310A20Aruba','F84001A20USA','F84001B20USA','F85101A20U.S.A. Eastern Office','F85201A20U.S.A. Central Office','F85301A20U.S.A. Western Office','F85501A20AT&T Key Account Dept','F85601A20U.S.A. Sprint Account Dept','F85701A20VRZ Key Account Dept','F85901A20T-Mobile Key Account Dept','F86101A20MSO Key Account Dept','F60401A20Peru','F48401A20Mexico','F48401B20Mexico','F06801A20Bolivia','F15201A20Chile','F07601A20Brazil') )  
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
        AND  1=1 
    GROUP BY
        recp.RECEIPT_ID,
        recph.REVERSE_DATE
)
SELECT
    /*+parallel(8)*/
    DISTINCT recp2.unit_code AS 账套,
    recp2.salesperson_name AS salesreps,
    recp2.receipt_number AS 收据号,
    nvl(recp_coa.coa, NULL) AS coa,
    recp2.receipt_method_name AS name,
    recp2.receipt_type AS TYPE,
    substr(recp_coa.coa, 10, 4) AS region,
    recp2.status AS 当前票据状态,
    recp2.account_number AS 客户代码,
    recp2.bp_name AS PARTY_NAME,
    recp2.comments,
    to_char(recp2.receipt_date, 'yyyy/mm/dd') AS receipt_date,
    recp2.currency_code AS 币种,
    recp2.total_amount AS amount,
    recp2.functional_total_amount AS REC_AMOUT_LC,
    recp2.NET_AMOUNT AS net_amount,
    recp2.FUNCTIONAL_NET_AMOUNT AS net_amount_lc,
    nvl(recp2.charges_amount, 0) AS bank_charge,
    recp2.exchange_rate_value AS exchange_rate,
    to_char(recp2.exchange_rate_date, 'yyyy/mm/dd') AS exchange_date,
    recp2.exchange_rate_type,
    recp2.issue_name,
    to_char(recp2.issue_date, 'yyyy/mm/dd') AS issue_date,
    to_char(recp2.gl_date, 'yyyy/mm/dd') AS gl_date,
    recp2.customer_serial_number AS customer_receipt_reference,
    to_char(recp_coa.reverse_date, 'yyyy/mm/dd') AS reversal_date,
    recp2.bank_name AS bank_account_name,
    recp2.bank_account_no AS bank_account_num,
    fuser.lname AS user_name,
    recp2.creation_date,
    recp2.document_no AS document_num
FROM
    recp_coa,
    SDIFIN.OGG_HAR_RECEIPT_8660_VI recp2,
    SDIIT.OGG_TPL_USER_T_8667 fuser
WHERE
    recp_coa.RECEIPT_ID = recp2.RECEIPT_ID
    AND recp2.CREATED_BY = fuser.USER_ID(+)

加入该语句后,执行时间从 3600.130s 降低为 17s

该语句的performance计划如附件所示。

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。