473,503 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cost based optomizer problem. CBO won't merge view

I'm having a serious problem with the cost based optimizer in Oracle
8i.

I've created a view off of a couple of tables using a "union all".
i.e.
create view a_anti_a_view
select a.id1, b.name from a, b where a.id1 = b.id
union all
select a.id2, b.name2 from a, b where a.id2 = b.id
Table 'a' has 100K rows but 'b' has < 300.

when I run the following query I get a 50msec response:
select *
from a_anti_a_view av
where av.asset_id = 822775;

however this one takes around 2 minutes.
select *
from a_anti_a_view av
where av.asset_id in (select id from temp_as);

Even though temp_as has only one row!
Looking at the explain plan it's clear the optomizer isn't merging
the sub select into the view! It therefore does full table scans on
the selects within the view and then hash-joins to the temp_as table.

Has anyone had this problem? Does anybody have any suggestions?

I've tried a number of things, including using hints (although I'm
not very familiar with them), analyzing the tables and indexes and
doing a join instead of an 'in' operation. none help.

Any help would be fantastic. This is a large project and I'm pretty
far under the gun.
Jul 19 '05 #1
1 4516
> select *
from a_anti_a_view av
where av.asset_id in (select id from temp_as);


You might try re-writing query as standard join and force a nested loop join:
select /*+ use_nl */
col_list
from
a_anti_a_view av,
temp_as t
where
av.asset_id =t.temp_as;
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3559
by: Dan | last post by:
I am a relatively new user on Oracle 9.2.0.1 and I am having trouble performance tuning this production database. I am running a large query that joins two tables, document(3 mil) and entity(9...
15
3802
by: Philip Mette | last post by:
I am begginner at best so I hope someone that is better can help. I have a stored procedure that updates a view that I wrote using 2 cursors.(Kind of a Inner Loop) I wrote it this way Because I...
41
3042
by: Matt Alanzo | last post by:
Our SOHO 2 person compay sells furniture (not programmers). In '98 we paid $,$$$ for a VBA -Access '97 accounting application, including VBA source code .... an huge investment for us then (and...
8
9493
by: Squirrel | last post by:
Hi everyone, I've created a mail merge Word doc. (using Office XP) , the data source is an Access query. Functionality I'm attempting to set up is: User sets a boolean field to true for...
4
7462
by: pmhaupt2 | last post by:
I developed an Access 2003 program that will allow the user to produce a group of Word letters that merge with data records from an Access database. I created a mail merge Word document and...
19
2712
by: Andy B | last post by:
Hello, Sorry for this newbish question. Briefly, my problem: ------------------ I expect the database I'm working on to reach something in the order of 12-16 Gigabytes, and I am interested...
16
4852
by: UDBDBA | last post by:
Hi All: I need some clarification on a MERGE statement. The database is on V8 FP12 (AIX) 64bit. The source table is tableA. The target is a View "FACT" with UNION ALL because of the 512 Gig...
0
2185
by: ho.horace | last post by:
Dear All, I am using SQL 2005 as pub and SQL EXPRESS as sub with Merge replication. Got the following error message The schema script 'CD_InTransit_v_153.sch' could not be propagated to the...
1
171
by: Mario | last post by:
I'm having a serious problem with the cost based optimizer in Oracle 8i. I've created a view off of a couple of tables using a "union all". i.e. create view a_anti_a_view select a.id1, b.name...
0
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7322
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6982
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7451
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5572
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5000
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3161
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
374
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.