Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

CTAS method takes long time - Any suggestion.

676292Feb 13 2009 — edited Feb 16 2009
Hi,

Please find the query below. The 'select' statement was taking more than a day time to execute and i tuned the same. Now i am getting the results in 5 seconds. But when i try to load the data that i get from 'select' statement into table using CTAS method, it takes more than 5 hours, but i don't see table created. Little background about this query...., this is for data warehousing project, every table in the 'select' has 5million records. The result set (executes in 5 second) will again have 5 million records. When loading the data into table for 5m records, it takes time. Is there a way to improve this.

create table tcu
tablespace tcu_cons
as
select /*+ ORDERED INDEX(a) INDEX(b) INDEX(c) INDEX(d) INDEX(e) INDEX(f) INDEX(g) USE_NL(a,b) USE_NL(b,c) USE_NL(c,d) USE_NL(d,e) USE_NL(e,f) USE_NL(f,g) */
a.prev_mo_tbr_amt,
(b.ytd_tbr_amt + NVL(g.tot_cris_tbr_amt,0)) ytd_tbr_amt,
c.prev_ytd_tbr_amt,
(d.lst_12_mo_tbr_amt + NVL(g.tot_cris_tbr_amt,0)) lst_12_mo_tbr_amt,
e.prev_lst_12_mo_tbr_amt,
f.sm_mo_lst_yr_tbr_amt,
g.tot_cris_tbr_amt,
a.row_id
from tmp_prevmo a,
tmp_ytd b,
tmp_prevytd c,
tmp_lst12 d,
tmp_prevlst12 e,
tmp_smmolstyr f,
csban_1 g
where a.acct_id = b.acct_id
and b.acct_id = c.acct_id
and c.acct_id = d.acct_id
and d.acct_id = e.acct_id
and e.acct_id = f.acct_id
and f.acct_id = g.acct_id;

Thanks,
Subbu.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 16 2009
Added on Feb 13 2009
12 comments
641 views