-
Hi friends, I am trying to write a procedure for generating a report using data in 3 tables.
table1 table2 table3 table4
col1 col5 col9 col1
col2 col6 col10 col4
col3 col7 col11 col7
col4 col8 col12 col11
table1 is a partitioned table with around 80 million records insertion per day.No indexes are present.
table 2 is having around 1.6 million records and table3 has about 100000 records.
The task is:
if col2=1 or 2, then, pick col3, match it with col6. If they are same, select col7 and finally display col1,col4 and col7
if col2=3 or 4, then, pick col3, match it with col10. If they are same, select col11 and finally display col1,col4 and col11.
Based on the values of col2(i.e., whether they are 1 or 2 and 3 or 4)I am trying to put the values of col3 in another (temp)table, say table4. Then into table 4, i am doing a select as insert from table2 or table3 based on the value of col2. The report will be generated using table4. So, my report will look, something like this:
col1 col4 col7 col11
... ... ...
... ... ...
... ... ...
... ... ...
I am afraid, that the performance using the above will be terrible. Can someone help me with any other suggestions?
Thanks
manjunath
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|