Weird problem :( [message #263360] |
Wed, 29 August 2007 18:54 |
lotusdeva
Messages: 201 Registered: March 2005
|
Senior Member |
|
|
This is really the weirdest problem I came across with Oracle Maybe someone have an idea on how to go about it? I have a PL/SQL application, a part of which is performing slow. I ran a trace, debugged, etc and finally found sql statement that was taking a long time. The problem is this:
- We are on Oracle 9i with Rule based optimizer with NO statistics on the database (I have no idea why, but DBAs refuse to run them). Hence, applying any hints that would invoke cost based optimizer is pointless...
- Say we have 2 tables: table_A and table_B. My application is doing a delete from Table_A. Table_B is not accessed anywhere in the application. Table_B, however, has a FK that connects it to Table_A. This FK is created without CASCADE option. There are NO triggers on either table_A or table_B. I traced the execution through TOAD and it shows that when there is a delete from table_A the following statement gets executed:
SELECT /*+all_rows*/
count(1)
FROM table_B
where id = :id
and code = :code.
This is crazy. This code is not exlusivelly written in the application, so it seems that Oracle does this dynamically. But why? I cant imagine wihy would Oracle apply a hint dynamically...Since we have rule based optimizer and statistincs are not collected and table_B has millions of rows from like 1995, this statement runs like 2-3 minutes. Does anyone have any idea as to why this can happen?
Thank you!
|
|
|
|
|
|
Re: Weird problem :( [message #263375 is a reply to message #263369] |
Wed, 29 August 2007 21:21 |
lotusdeva
Messages: 201 Registered: March 2005
|
Senior Member |
|
|
Actually, its true. We do have a third party product that comes with RBO, but if I was a DBA I would at least gather statistics on our tables.. I noticed that if I add ALL_ROWS or FIRST_ROWS hint to any of our queries the actually perform slower. This tells me that dynamic sampling is not doing us any good
|
|
|