Oracle性能调优顺序需要时间

时间:2014-10-22 04:47:45

标签: oracle performance

我有查询,其中有两个字段并获得输出pps_idtotal_weight。这里pps_id是表中的列,total_weight是我们从内部查询计算的。在查询中执行所有过程之后,我们按查询按总重量排序。它需要更多的成本和响应。有任何方法可以提高查询性能。

    SELECT PPS_ID, TOTAL_WEIGHT
  FROM (  SELECT PPS_ID, TOTAL_WEIGHT
            FROM (SELECT pps_id,
                         ROUND (
                              (  (  (60 * name_pct_match / 100)
                                  + prs_weight
                                  + year_weight
                                  + dt_weight)
                               / 90)
                            * 100)
                            total_weight
                    FROM (SELECT pps_id,
                                 ROUND (func_compare_name ('aaaa',
                                                           UPPER (name_en),
                                                           ' ',
                                                           60))
                                    name_pct_match,
                                 DECODE (prs_nationality_id, 99, 15, 0)
                                    prs_weight,
                                 10 mother_weight,
                                 100 total_attrib_weight,
                                 CASE
                                    WHEN TO_NUMBER (
                                            TO_CHAR (birth_date, 'yyyy')) =
                                            1986
                                    THEN
                                       5
                                    ELSE
                                       0
                                 END
                                    year_weight,
                                 CASE
                                    WHEN     TO_CHAR (
                                                TO_DATE ('12-JAN-86',
                                                         'DD-MON-RRRR'),
                                                'dd') =
                                                TO_CHAR (birth_date, 'dd')
                                         AND TO_CHAR (
                                                TO_DATE ('12-JAN-86',
                                                         'DD-MON-RRRR'),
                                                'mm') =
                                                TO_CHAR (birth_date, 'mm')
                                    THEN
                                       10
                                    WHEN TO_DATE ('12-JAN-86', 'DD-MON-RRRR') BETWEEN   birth_date
                                                                                      - 6
                                                                                  AND   birth_date
                                                                                      + 6
                                    THEN
                                       8
                                    WHEN TO_DATE ('12-JAN-86', 'DD-MON-RRRR') BETWEEN   birth_date
                                                                                      - 28
                                                                                  AND   birth_date
                                                                                      + 28
                                    THEN
                                       5
                                    WHEN TO_DATE ('12-JAN-86', 'DD-MON-RRRR') BETWEEN   birth_date
                                                                                      - 90
                                                                                  AND   birth_date
                                                                                      + 90
                                    THEN
                                       3
                                    ELSE
                                       0
                                 END
                                    dt_weight
                            FROM individual_profile
                           WHERE     birth_date = '12-JAN-86'
                                 AND IS_ACTIVE = 1
                                 AND gender_id = 1
                                 AND ROUND (func_compare_name ('aaa',
                                                               UPPER (name_en),
                                                               ' ',
                                                               60)) > 20))
           WHERE TOTAL_WEIGHT >= 100
        ORDER BY total_weight DESC)
 WHERE ROWNUM <= 10

我试过通过拆分查询并将值放在临时表中并尝试但是它也需要时间。我想提高查询的性能

0 个答案:

没有答案