我们有一个从Oracle 10g数据库中提取数据的报告。 我们使用Coldfusion 9来显示报告。 该报告包含3个CLOB列,这些列会终止报告处理时间。 通过删除三个CLOB列并在2-3秒内报告显示来测试它。
是否可以采取任何措施来延长报告的处理时间? 我理解为什么由于CLOB字段有多大而导致它运行缓慢。 只是希望改善处理时间。
只是想知道行典型的报告返回200-300行,所以行数非常少。
非常感谢马修
UPDATE - 我们尝试使用dbms_lob.substr()并返回最大4000字符,但这不会缩短处理时间。
这是查询:
SELECT
R.NC_REQUEST_ID REQUEST_ID,
R.TC_REQUEST_NAME REQUEST_NAME,
R.TC_REQUEST_NAME_2 REQUEST_NAME_2,
R.TC_INITIATOR INITIATOR,
R.NC_EXPENSE EXPENSE,
S.NC_FORM_STEP_ID FORM_STEP_ID,
S.NC_FORM_ID FORM_ID,
S.NC_STEP_ID STEP_ID,
S.TC_STEP_CODE STEP_CODE,
S.TC_STEP_NAME STEP_NAME,
TO_CHAR(R.DC_SUBMIT_DATE,'DD-Mon-YYYY') SUBMIT_DATE,
TO_CHAR(R.DC_ORIGINAL_DATE,'DD-Mon-YYYY') ORIGINAL_DATE,
TO_CHAR(R.DC_REVISION_DATE,'DD-Mon-YYYY') REVISION_DATE,
R.NC_BUS_GROUP_ID_FK BUS_GROUP_ID,
R.NC_BUS_UNIT_ID_FK BUS_UNIT_ID,
R.NC_BUS_SUB_ID_FK BUS_SUB_ID,
R.TC_ACT_NUMBER ACT_NUMBER,
R.TC_REQUEST_NAME REQUEST_NAME,
R.NC_YEAR YEAR_NUM,
R.NC_ACT_END_NUMBER ACT_END_NUMBER,
R.DC_START_DATE START_DATE,
R.DC_END_DATE END_DATE,
R.NC_ACT_TYPE_ID_FK ACT_TYPE_ID_FK,
TO_CHAR(R.DC_APPROVAL_DATE,'DD-Mon-YYYY') APPROVAL_DATE,
CC_ATTACHED_EXHIBIT ATTACHED_EXHIBIT,
CC_ROUTED ROUTED,
R.IC_RESTRICTED RESTRICTED,
ROI.NC_PI_OFF PI_OFF,
ROI.NC_PI_CA COST_AVOIDANCE_PI,
(SELECT COUNT(NC_REQUEST_ID_FK) FROM TBXS31_REMOVE_SECTION WHERE NC_REQUEST_ID_FK = R.NC_REQUEST_ID AND NC_TEMPLATE_ID_FK IN(346,1455,1456,1458,1459,1460,1464.1641) GROUP BY NC_REQUEST_ID_FK) AS COUNT_OF_REMOVE_SECTIONS,
<cfoutput query="variables.qryEnergyListItems">
(SELECT NVL(ED.NC_EXISTINGUSAGE - ED.NC_PROPOSEDUSAGE,0) FROM TBYB28_SI_ENERGY_DATA ED,TBXP73_LIST_ITEMS LI WHERE LI.NC_VALUE_ID = ED.NC_ENERGYFORM(+) AND LI.NC_VALUE_ID = #variables.qryEnergyListItems.NC_VALUE_ID# AND ED.NC_REQUEST_ID_FK = R.NC_REQUEST_ID AND LI.IC_ACTIVE = 'T' AND LI.NC_VALUE_ID <> 808) AS "#variables.qryEnergyListItems.TC_MED_DESC#",
</cfoutput>
(SELECT TC_MED_DESC FROM TBXP73_LIST_ITEMS WHERE NC_VALUE_ID = SD.NC_BUSINESSUNIT) AS TC_BUS_UNIT,
(SELECT TC_MED_DESC FROM TBXP73_LIST_ITEMS WHERE NC_VALUE_ID = SD.NC_BUSINESSSUBUNIT) AS TC_BUS_SUB_UNIT,
(SELECT TC_MED_DESC FROM TBXP73_LIST_ITEMS WHERE NC_VALUE_ID = SD.NC_SITE) AS TC_BUS_SITE,
(SELECT NC_PROPOSEDGHG - NC_EXISTINGGHG FROM TBYB27_SUSTAINABILITY_DATA WHERE NC_REQUEST_ID_FK = R.NC_REQUEST_ID) AS ANNUAL_IMPACT_C02E,
(SELECT DECODE(TBYB14_SI_BASELINE.NC_BASE_CO2E , 0, NULL, ((TBYB27_SUSTAINABILITY_DATA.NC_PROPOSEDGHG - TBYB27_SUSTAINABILITY_DATA.NC_EXISTINGGHG) / TBYB14_SI_BASELINE.NC_BASE_CO2E) * 100) FROM TBYB14_SI_BASELINE,TBYB27_SUSTAINABILITY_DATA WHERE TBYB27_SUSTAINABILITY_DATA.NC_REQUEST_ID_FK = R.NC_REQUEST_ID AND TBYB27_SUSTAINABILITY_DATA.NC_SITE = TBYB14_SI_BASELINE.NC_SITE_ID_FK(+) AND TBYB27_SUSTAINABILITY_DATA.NC_BASELINEYEAR = TBYB14_SI_BASELINE.NC_YEAR(+) ) AS PCT_IMPACT_CO2E,
(SELECT NC_PROPOSEDWASTE - NC_EXISTINGWASTE FROM TBYB27_SUSTAINABILITY_DATA WHERE NC_REQUEST_ID_FK = R.NC_REQUEST_ID) AS ANNUAL_IMPACT_WASTE,
(SELECT DECODE(TBYB14_SI_BASELINE.NC_BASE_WASTE, 0, NULL, ((TBYB27_SUSTAINABILITY_DATA.NC_PROPOSEDWASTE - TBYB27_SUSTAINABILITY_DATA.NC_EXISTINGWASTE) / TBYB14_SI_BASELINE.NC_BASE_WASTE) * 100) FROM TBYB14_SI_BASELINE,TBYB27_SUSTAINABILITY_DATA WHERE TBYB27_SUSTAINABILITY_DATA.NC_REQUEST_ID_FK = R.NC_REQUEST_ID AND TBYB27_SUSTAINABILITY_DATA.NC_SITE = TBYB14_SI_BASELINE.NC_SITE_ID_FK(+) AND TBYB27_SUSTAINABILITY_DATA.NC_BASELINEYEAR = TBYB14_SI_BASELINE.NC_YEAR(+) ) AS PCT_IMPACT_WASTE,
(SELECT NC_PROPOSEDWATER - NC_EXISTINGWATER FROM TBYB27_SUSTAINABILITY_DATA WHERE NC_REQUEST_ID_FK = R.NC_REQUEST_ID) AS ANNUAL_IMPACT_WATER,
(SELECT DECODE(TBYB14_SI_BASELINE.NC_BASE_WATER, 0, NULL, ((TBYB27_SUSTAINABILITY_DATA.NC_PROPOSEDWATER - TBYB27_SUSTAINABILITY_DATA.NC_EXISTINGWATER) / TBYB14_SI_BASELINE.NC_BASE_WATER) * 100) FROM TBYB14_SI_BASELINE,TBYB27_SUSTAINABILITY_DATA WHERE TBYB27_SUSTAINABILITY_DATA.NC_REQUEST_ID_FK = R.NC_REQUEST_ID AND TBYB27_SUSTAINABILITY_DATA.NC_SITE = TBYB14_SI_BASELINE.NC_SITE_ID_FK(+) AND TBYB27_SUSTAINABILITY_DATA.NC_BASELINEYEAR = TBYB14_SI_BASELINE.NC_YEAR(+) ) AS PCT_IMPACT_WATER,
(SELECT TBXS32_TEXT_SECTIONS.TC_TEXT FROM TBXS32_TEXT_SECTIONS WHERE TBXS32_TEXT_SECTIONS.NC_REQUEST_ID_FK = R.NC_REQUEST_ID AND TBXS32_TEXT_SECTIONS.NC_TEMPLATE_ID_FK = 570 AND NC_SUBSECTION_ID = 0) AS PROPOSAL_TEXT,
(SELECT TBXS32_TEXT_SECTIONS.TC_TEXT FROM TBXS32_TEXT_SECTIONS WHERE TBXS32_TEXT_SECTIONS.NC_REQUEST_ID_FK = R.NC_REQUEST_ID AND TBXS32_TEXT_SECTIONS.NC_TEMPLATE_ID_FK = 1456 AND NC_SUBSECTION_ID = 0) AS COMMENTS_EXPLANATIONS,
(SELECT TBXS32_TEXT_SECTIONS.TC_TEXT FROM TBXS32_TEXT_SECTIONS WHERE TBXS32_TEXT_SECTIONS.NC_REQUEST_ID_FK = R.NC_REQUEST_ID AND TBXS32_TEXT_SECTIONS.NC_TEMPLATE_ID_FK = 1458 AND NC_SUBSECTION_ID = 0) AS COMMENTS_ON_ADD_SI_IMPACTS,
<!--- Get Capital --->
(
SELECT
SUM(NVL((NC_QUANTITY * COST) * (1 + NC_TAX_RATE),0))
FROM
(
SELECT
E.*,
NVL(E.MC_COST,0) * FROM_CURR.NC_EXCHANGE_RATE / TO_CURR.NC_EXCHANGE_RATE COST,
E.MC_MAINT_COST * FROM_CURR.NC_EXCHANGE_RATE / TO_CURR.NC_EXCHANGE_RATE MAINT_COST
FROM
TBXS23_EXPENDITURES E,
TBXS41_EXCHANGE_RATE_CIT FROM_CURR,
TBXS41_EXCHANGE_RATE_CIT TO_CURR,
TBXP78_REQUESTS R,
V_TBXS13_STEPS SS
WHERE
R.NC_ACT_TYPE_ID_FK != 40
AND
R.NC_FORM_STEP_ID_FK = SS.NC_FORM_STEP_ID
AND
E.NC_REQUEST_ID_FK = R.NC_REQUEST_ID
AND
TO_CURR.NC_CURRENCY_ID = <cfqueryparam value="#session.objUser.getCurrencyPreference()#" cfsqltype="cf_sql_numeric">
AND
E.NC_CURRENCY_ID_FK = FROM_CURR.NC_CURRENCY_ID
AND
E.NC_EXPENDITURE_TYPE_ID_FK = 83
AND
R.DC_APPROVAL_DATE
BETWEEN
TO_CURR.DC_VALID_FROM
AND
TO_CURR.DC_VALID_TO
AND
R.DC_APPROVAL_DATE
BETWEEN
FROM_CURR.DC_VALID_FROM
AND
FROM_CURR.DC_VALID_TO
) WHERE NC_REQUEST_ID_FK = R.NC_REQUEST_ID
)AS CAPITAL,
<!--- Get Capital --->
<!--- Project Expense One Time --->
(
SELECT
SUM(NVL((NC_QUANTITY * COST) * (1 + NC_TAX_RATE),0))
FROM
(
SELECT
E.*,
NVL(E.MC_COST,0) * FROM_CURR.NC_EXCHANGE_RATE / TO_CURR.NC_EXCHANGE_RATE COST,
E.MC_MAINT_COST * FROM_CURR.NC_EXCHANGE_RATE / TO_CURR.NC_EXCHANGE_RATE MAINT_COST
FROM
TBXS23_EXPENDITURES E,
TBXS41_EXCHANGE_RATE_CIT FROM_CURR,
TBXS41_EXCHANGE_RATE_CIT TO_CURR,
TBXP78_REQUESTS R,
V_TBXS13_STEPS SS
WHERE
R.NC_ACT_TYPE_ID_FK != 40
AND
R.NC_FORM_STEP_ID_FK = SS.NC_FORM_STEP_ID
AND
E.NC_REQUEST_ID_FK = R.NC_REQUEST_ID
AND
TO_CURR.NC_CURRENCY_ID = <cfqueryparam value="#session.objUser.getCurrencyPreference()#" cfsqltype="cf_sql_numeric">
AND
E.NC_EXPENDITURE_TYPE_ID_FK = 84
AND
E.NC_CURRENCY_ID_FK = FROM_CURR.NC_CURRENCY_ID
AND
R.DC_APPROVAL_DATE
BETWEEN
TO_CURR.DC_VALID_FROM
AND
TO_CURR.DC_VALID_TO
AND
R.DC_APPROVAL_DATE
BETWEEN
FROM_CURR.DC_VALID_FROM
AND
FROM_CURR.DC_VALID_TO
) WHERE NC_REQUEST_ID_FK = R.NC_REQUEST_ID
)AS PROJECT_EXPENSE
<!--- Project Expense One Time --->
FROM
TBXP78_REQUESTS R,
V_TBXS13_STEPS S,
TBXS39_ROI ROI,
TBYB27_SUSTAINABILITY_DATA SD
WHERE
R.NC_FORM_STEP_ID_FK = S.NC_FORM_STEP_ID
AND
R.NC_REQUEST_ID = ROI.NC_REQUEST_ID_FK(+)
AND
R.NC_REQUEST_ID = SD.NC_REQUEST_ID_FK(+)
AND
R.NC_ACT_TYPE_ID_FK != 40
这些是CLOB字段:
(SELECT TBXS32_TEXT_SECTIONS.TC_TEXT FROM TBXS32_TEXT_SECTIONS WHERE TBXS32_TEXT_SECTIONS.NC_REQUEST_ID_FK = R.NC_REQUEST_ID AND TBXS32_TEXT_SECTIONS.NC_TEMPLATE_ID_FK = 570 AND NC_SUBSECTION_ID = 0) AS PROPOSAL_TEXT,
(SELECT TBXS32_TEXT_SECTIONS.TC_TEXT FROM TBXS32_TEXT_SECTIONS WHERE TBXS32_TEXT_SECTIONS.NC_REQUEST_ID_FK = R.NC_REQUEST_ID AND TBXS32_TEXT_SECTIONS.NC_TEMPLATE_ID_FK = 1456 AND NC_SUBSECTION_ID = 0) AS COMMENTS_EXPLANATIONS,
(SELECT TBXS32_TEXT_SECTIONS.TC_TEXT FROM TBXS32_TEXT_SECTIONS WHERE TBXS32_TEXT_SECTIONS.NC_REQUEST_ID_FK = R.NC_REQUEST_ID AND TBXS32_TEXT_SECTIONS.NC_TEMPLATE_ID_FK = 1458 AND NC_SUBSECTION_ID = 0) AS COMMENTS_ON_ADD_SI_IMPACTS,