Home > database >  Oracle11g, associated query within 3 tables, half an hour to have no reaction, what reason?
Oracle11g, associated query within 3 tables, half an hour to have no reaction, what reason?

Time:09-22

3 tables, queries and a half hours



Each table data is as follows:






CodePudding user response:

Is there a suitable correlation index, your estimate of how much

CodePudding user response:

The three best table structure, and index all the way,

PS: statistical information is the latest?

CodePudding user response:

Look at oracle execution plan, estimate without a valid index, a full table scan, but according to the information you provide, the data quantity is not big, first built so give it a try so include: a table increase index ZHDH, increase ZHDN table b, c table increase index kh, a table indexed kn

CodePudding user response:

Can the table structure more clearly?

CodePudding user response:

The efficiency problem,,,,,,,

CodePudding user response:

Directly with use_hash suggest don't use any index, definitely won't run for half an hour, unless your server disk bad don't don't...

CodePudding user response:

The select/* + use_hash (a, b) use_hash (a, c) */the from XXX...

CodePudding user response:

See used to correlate the three fields in separate table have a lot of repetition, few data wouldn't be so slow even worst execution plan,

CodePudding user response:

1. Confirm your condition is one-to-one or many-to-many;
One-on-one situations
2. Check the execution plan, if condition 1 is one-to-one the SQL running is definitely going slow nested;
3. To collect statistics under the SQL execution is normal, or, as the upstairs said add hint/* + use_hash (a, b, c) */
One-to-many or on
4. Can the summary before they are associated