Links
Home
Oracle DBA Forum
Frequent Oracle Errors
TNS:could not resolve the connect identifier specified
Backtrace message unwound by exceptions
invalid identifier
PL/SQL compilation error
internal error
missing expression
table or view does not exist
end-of-file on communication channel
TNS:listener unknown in connect descriptor
insufficient privileges
PL/SQL: numeric or value error string
TNS:protocol adapter error
ORACLE not available
target host or object does not exist
invalid number
unable to allocate string bytes of shared memory
resource busy and acquire with NOWAIT specified
error occurred at recursive SQL level string
ORACLE initialization or shutdown in progress
archiver error. Connect internal only, until freed
snapshot too old
unable to extend temp segment by string in tablespace
Credential retrieval failed
missing or invalid option
invalid username/password; logon denied
unable to create INITIAL extent for segment
out of process memory when trying to allocate string bytes
shared memory realm does not exist
cannot insert NULL
TNS:unable to connect to destination
remote database not found'>ora-02019
exception encountered: core dump
inconsistent datatypes
no data found
TNS:operation timed out
PL/SQL: could not find program
existing state of packages has been discarded
maximum number of processes exceeded
error signaled in parallel query server
ORACLE instance terminated. Disconnection forced
TNS:packet writer failure
see ORA-12699
missing right parenthesis
name is already used by an existing object
cannot identify/lock data file
invalid file operation
quoted string not properly terminated
A Cure for Madness

A Cure for Madness

2004-08-29       - By Wolfgang Breitling

Reply:     1     2     3     4     5     6     7     8     9     10     >>  

At 12:14 PM 8/29/2004, you wrote:
>Wolfgang,
> I defintely agree with you on some points.
> First, (as Jonathan pointed out to me), Date does mention that
> merging should be allowed, specifically for the sake of performance.

That 's not what he says in the article. There he gives an "unequivocal no "
to the question whether it is valid to rewrite the query.

> Second, he goes on to explain that the merging done by the cbo
>should/can
> be done as long as it does not cause an error or change the intended
>result
> of the query (that 's the part I don 't like).
> So, I think he 's saying (as was Jonathan originally),=20
> sure, go ahead and merge as long as the cbo "knows " what we want to do
>and=20
> the merging does not cause an error (even if it 's our error).

I don 't like the "as long as it does not cause an error " part. How can you
know in advance what causes an error. Is the optimizer not allowed to use a
SM join because it might run out of sort space?
The current rules are pretty simple - the optimizer can rewrite the query
as long as the end result (I 'd avoid the term "intended " - sometimes, and
not even that rarely, the "intended " result and the actual result of the
query as written are not the same) does not change.


> In Date 's "An Introduction To Database Systems 7th ed. ", chapter 17
>(Optimization),
> he walks through some simple examples.
> On page 539:
> =20
> ( ( SP JOIN S ) WHERE P# =3D P# ( 'P2 ' ) ) { SNAME }
>
>
> based on the order of how the query was written the cbo would:
> 1. join sp and s on p# (getting all the matches!!)
> 2. then restrict the P2 tuples
> 3. finally project sname
>
> Date himself (on that same page) suggests the cbo should instead:
> 1. restrict sp to only the P2 tuples
> 2. join that result to s on p#
> 3. finally, project sname
>
> He gives another example on pg. 545 as well. It 's obvious query rewrite
>can be beneficial.=20
> He does however state (in the book and article)
> that these optimizations should be done without changing the resultset=20
> ( "changing " in regards to the article caused the Invalid Number error).

This is where I disagree. The error was not caused by rewriting the query
but by the fact that the function used is not well defined over the domain
of the argument, which is what I attempted to show with my "my_to_number "
function.

> My question is, does the merging we notice really change the resultset?
> I don 't think so, it barfs because you want to perform a number
>comparison on a string.

My point exactly

> Should the cbo have to handle stuff like that???

No. It has enough on its hands to optimize sql, it should not compensate
for our mistakes. I am annoyed enough by MS Word trying to second-guess my
"intend ". I 'd much rather it stick to do what I ask it to do.


Regards

Wolfgang Breitling
Centrex Consulting Corporation
www.centrexcc.com

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe send email to: oracle-l-request@(protected)
put 'unsubscribe ' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --