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!

Creating a view using tables with a large number of rows

839900Feb 15 2011 — edited Feb 18 2011
I have a view 'test_view' which is composed of two tables:
- 'table_a'
- 'table_b'
Each of them has more than 10 million records.
Query creating that view is below:

create view test_view as
select * from table_a t
union all
select * from table_b t

Efficiency of that view is very poor (while using it with other queries). Few indexes has been added but it didn't help. I think that the cost is high because of a large number of data.

When I created a table ('table_c') in which all rows from table 'table_a' and table 'table_b' were inserted - efficiency was much better (it was done just for test).

What is the logical difference (why the efficiency is so different) between view 'test_view' and table 'table_c' ?
Is there another solution to make that view run more efficiently (maybe some database settings should be modify) ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 17 2011
Added on Feb 15 2011
4 comments
949 views