Wrong results with cost-based optimizer?
Date: Mon, 25 Apr 94 13:14:24 GMT
Message-ID: <1994Apr25.131424.4252_at_wmdhh.wmd.de>
Hi folx.
Because of performance problems in one of our applications we tried Oracle's cost-based optimizer. We did the following: fist, we generated statistics on all tables with
ANALYZE TABLE <table> COMPUTE STATISTICS;
and then we switched the RDBMS (on a per session basis) explicitly to cost based optimization with
ALTER SESSION SET OPTIMIZER_GOAL = FIRST_ROWS; After doing this, we observed that several SELECT statements (with outer joins only?) gave other results than before. For example, the statement
SELECT COUNT(*)
FROM person, address
WHERE person.address_id = address.id (+);
^ fk 1:c ^ pk
yields 33482 (# of all persons with an address) in case of
cost based optimization and 57081 (# of all persons with or without
an address) in case of rule based optimization. Only the latter
result is correct, of course.
Is this a known bug? Is there any way to avoid such incorrect behavior of the cost-based optimizer? Or did we made something wrong?
-- Frank Seitz, WMD GmbH, Hamburg, +49-40-58958-175, seitz_at_wmd.deReceived on Mon Apr 25 1994 - 15:14:24 CEST