SQL Performance (MOSC)

MOSC Banner

query performance with the most updated statistics is far worse than without any statistics

edited Jun 20, 2015 10:00AM in SQL Performance (MOSC) 3 commentsAnswered

I have a query performance issue which I believe is related to statistics collection.

There are 3 tables in the query and one of the table is 30GB. The other 2 tables are small.

When there is no statistics in the large table, the query takes about 6 minutes to complete.

After gathering the statistics, the query takes 15 HOURS to complete.

The sympton can be reproduced at will.

Why a 100% accurate statistics would result in a far worse performance?

What could have gone wrong?

Here is the way I collect the statistics:

(The query does not use bind variables.)

begin

        dbms_stats.gather_table_stats(

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center