[Oracle]:查询在一个分区中执行时挂起,但在其他分区中不执行相同 table

[Oracle]: A query hangs when is executed in a partition but not in others partitions for the same table

我有一个按 A 列分区的 table。分区 Z 的 table 有 800000 条记录,分区 V 有 5000000(更多)。我已经检查了所有索引并且处于活动状态。

table ALL_TAB_PARTITIONS 中的分区看起来不错。

我在分区 Z 中执行一个查询,它挂起,我不得不在它执行 5 小时时将其杀死,但在分区 V 中运行得非常快,1.2 秒。

我还观察到不同分区中的相同查询使用 table 的不同索引。

我不知道为什么。

有人知道为什么会发生这种情况吗?

提前致谢。

谢谢大家的回复,我知道我没有提供太多信息。

问题已通过重建分区 Z 的所有索引解决。

显然问题是由统计信息引起的,我不得不重建索引。

索引是这样重建的:

alter index TABLE_IDX0 rebuild partition Z  ONLINE COMPUTE STATISTICS;
alter index TABLE_IDX1 rebuild partition Z  ONLINE COMPUTE STATISTICS;
alter index TABLE_IDX2 rebuild partition Z  ONLINE COMPUTE STATISTICS;
alter index TABLE_IDX3 rebuild partition Z  ONLINE COMPUTE STATISTICS;
alter index TABLE_IDX4 rebuild partition Z  ONLINE COMPUTE STATISTICS;
alter index TABLE_IDX5 rebuild partition Z  ONLINE COMPUTE STATISTICS;