Discussions
Categories
- 196.9K All Categories
- 2.2K Data
- 239 Big Data Appliance
- 1.9K Data Science
- 450.3K Databases
- 221.7K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 550 MySQL Community Space
- 478 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 545 SQLcl
- 4K SQL Developer Data Modeler
- 187K SQL & PL/SQL
- 21.3K SQL Developer
- 295.9K Development
- 17 Developer Projects
- 138 Programming Languages
- 292.6K Development Tools
- 107 DevOps
- 3.1K QA/Testing
- 646K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 155 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 18 Java Essentials
- 160 Java 8 Questions
- 86K Java Programming
- 80 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 204 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 439 LiveLabs
- 38 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 171 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 232 Portuguese
query getting long run and not giving result

im using oracle 12 plsql developer
this query execution getting long executing mote than 6days. i thinks its getting infinite loop.
we are doing consolidating the value by using column are mentioned in connect by clause. based on the hierarchy we took rank1 rows. basically we reducing the number of rows. this query is giving the result in 30sec for records more than 40lakhs. but I'm facing issue when trying to execute attached data there is 972 rows available. please help me find out the issue . (xl file
attached which is pertains to table temp_final_consolidated_1)
temp_final_consolidated_1.xlsx
with temp_fc as
(select /*+PARALLEL (C,6)*/
C.*
from temp_final_consolidated_1 C )
SELECT f.*, f.new_to_age new_to_age1
FROM (SELECT e.*,
row_number() over(PARTITION BY product_code, brokerage_type, report_description, date_flag_for_rate_selection, folio_no || purch_id || cons_code || brok_dlr_code || brok_dlr_catg, asset_class || sub_fund_code || scheme_code, source_asset_class || source_sub_fund_code || source_scheme_code, sys_regn_to_date, sys_regn_from_date, trade_date_to, trade_date_from, ter_location, transaction_head, sub_type, from_amount, to_amount, brokerage_rate, new_from_age, new_to_age || adj_advance_upfront ORDER BY product_code, brokerage_type, report_description, new_from_age, new_to_age) rank1
FROM (SELECT MIN(d.from_age) over(PARTITION BY product_code, brokerage_type, report_description, date_flag_for_rate_selection, folio_no || purch_id || cons_code || brok_dlr_code || brok_dlr_catg, asset_class || sub_fund_code || scheme_code, source_asset_class || source_sub_fund_code || source_scheme_code, sys_regn_to_date, sys_regn_from_date, trade_date_to, trade_date_from, ter_location, transaction_head, sub_type, from_amount, to_amount, brokerage_rate, new_to_age || adj_advance_upfront ORDER BY product_code, brokerage_type, report_description, new_to_age) new_from_age,
d.*
FROM (SELECT MAX(to_age) over(PARTITION BY product_code, brokerage_type, report_description, date_flag_for_rate_selection, folio_no || purch_id || cons_code || brok_dlr_code || brok_dlr_catg, asset_class || sub_fund_code || scheme_code, source_asset_class || source_sub_fund_code || source_scheme_code, sys_regn_to_date, sys_regn_from_date, trade_date_to, c.trade_date_from, ter_location, transaction_head, sub_type, from_amount, to_amount, brokerage_rate, c.root_from_age || adj_advance_upfront ORDER BY root_from_age) new_to_age,
c.*
FROM (SELECT /*+PARALLEL (C,6)*/
c.*, connect_by_root from_age AS root_from_age
FROM temp_fc c
CONNECT BY prior to_age+1 = from_age and
PRIOR nvl(brokerage_rate, 0) =
nvl(brokerage_rate, 0)
AND PRIOR nvl(brokerage_type, '$$') =
nvl(brokerage_type, '$$')
AND PRIOR nvl(product_code, '$$') =
nvl(product_code, '$$')
AND PRIOR nvl(report_description, '$$') =
nvl(report_description, '$$')
AND PRIOR nvl(folio_no, '$$') =
nvl(folio_no, '$$')
AND PRIOR
nvl(purch_id, 0) = nvl(purch_id, 0)
AND PRIOR nvl(cons_code, '$$') =
nvl(cons_code, '$$')
AND PRIOR nvl(brok_dlr_code, '$$') =
nvl(brok_dlr_code, '$$')
AND PRIOR nvl(brok_dlr_catg, '$$') =
nvl(brok_dlr_catg, '$$')
AND PRIOR nvl(asset_class, '$$') =
nvl(asset_class, '$$')
AND PRIOR nvl(sub_fund_code, '$$') =
nvl(sub_fund_code, '$$')
AND PRIOR nvl(scheme_code, '$$') =
nvl(scheme_code, '$$')
AND PRIOR nvl(source_asset_class, '$$') =
nvl(source_asset_class, '$$')
AND PRIOR nvl(source_sub_fund_code, '$$') =
nvl(source_sub_fund_code, '$$')
AND PRIOR nvl(source_scheme_code, '$$') =
nvl(source_scheme_code, '$$')
AND PRIOR nvl(load_basis, '$$') =
nvl(load_basis, '$$')
AND PRIOR nvl(fee_aging, '$$') =
nvl(fee_aging, '$$')
AND PRIOR nvl(transaction_head, '$$') =
nvl(transaction_head, '$$')
AND PRIOR nvl(sub_type, '$$') =
nvl(sub_type, '$$')
AND PRIOR
nvl(date_flag_for_rate_selection,
'$$') = nvl(date_flag_for_rate_selection,
'$$')
AND PRIOR nvl(sys_regn_from_date,
'31-Dec-2999') =
nvl(sys_regn_from_date,
'31-Dec-2999')
AND PRIOR
nvl(sys_regn_to_date, '31-Dec-2999') =
nvl(sys_regn_to_date, '31-Dec-2999')
AND PRIOR
nvl(trade_date_from, '31-Dec-2999') =
nvl(trade_date_from, '31-Dec-2999')
AND PRIOR
nvl(trade_date_to, '31-Dec-2999') =
nvl(trade_date_to, '31-Dec-2999')
AND PRIOR nvl(ter_location, '$$') =
nvl(ter_location, '$$')
AND PRIOR nvl(from_amount, 0) =
nvl(from_amount, 0)
AND PRIOR nvl(to_amount, 0) =
nvl(to_amount, 0)
AND PRIOR nvl(tf_valuation_basis, '$$') =
nvl(tf_valuation_basis, '$$')
ORDER BY from_age,
to_age,brokerage_rate,
folio_no,
purch_id,
cons_code,
brok_dlr_code,
brok_dlr_catg,
asset_class,
sub_fund_code,
scheme_code,
source_asset_class,
source_sub_fund_code,
source_scheme_code,
load_basis,
fee_aging,
transaction_head,
sub_type,
date_flag_for_rate_selection,
sys_regn_from_date,
sys_regn_to_date,
trade_date_from,
trade_date_to,
ter_location,
from_amount,
tf_valuation_basis) c) d) e) f
WHERE rank1 = 1
Answers
-
Please close this question here as it is duplicated over at https://community.oracle.com/tech/developers/discussion/4498708/im-using-oracle-12c-select-query-executing-faster-but-insert-is-getting-longer#latest