Home > database >  Passing big help to look at the questions about multiple decode efficiency,
Passing big help to look at the questions about multiple decode efficiency,

Time:09-24


The SELECT COUNTY_ID,
The SUM (decode (CONCAT (FEE_YEAR LPAD (FEE_MONTH, 2 '0')), '201603', MONEY, 0)),
The SUM (decode (CONCAT (FEE_YEAR LPAD (FEE_MONTH, 2 '0')), '201604', MONEY, 0)),
The SUM (decode (CONCAT (FEE_YEAR LPAD (FEE_MONTH, 2 '0')), '201605', MONEY, 0)),
The SUM (decode (CONCAT (FEE_YEAR LPAD (FEE_MONTH, 2 '0')), '201703', MONEY, 0)),
The SUM (decode (CONCAT (FEE_YEAR LPAD (FEE_MONTH, 2 '0')), '201704', MONEY, 0)),
The SUM (decode (CONCAT (FEE_YEAR LPAD (FEE_MONTH, 2 '0')), '201705', MONEY, 0)),
The FROM
(the SELECT FE. COUNTY_ID, FE FEE_YEAR, FE. FEE_MONTH, SUM (FE) MONTHLY_MONEY) MONEY FROM FE_MT_FEE_FILL FE GROUP BY FE. COUNTY_ID, FE. FEE_YEAR, FE. FEE_MONTH)
GROUP BY COUNTY_ID


This is my SQL, in which the SUM (decode (CONCAT (FEE_YEAR, LPAD (FEE_MONTH, 2 '0')), '201705', MONEY, 0)) by joining together the SQL, are used to implement multiple lines turn a line, the number is variable, and may be any number, I want to ask, in SUM, decode (CONCAT (FEE_YEAR, LPAD (FEE_MONTH, 2 '0')), '201705', MONEY, 0)) number and more database under the condition of special data will there be special significantly lower efficiency

CodePudding user response:

Affect the efficiency of the general is not a function

CodePudding user response:

General main consumption efficiency in IO on the physical disk read and logic,
The influence of functional operation efficiency scores of small,