Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我使用 重建不可用的索引alter index x rebuild,是否会重新评估以前使用该索引的任何 SQL 的执行计划?
alter index x rebuild
我知道在我正在使用的数据库版本(Oracle 10.2.0.4.0)中,作为重建的一部分重新计算了统计信息。
我不想使用 dbms_stats 包来强制解决这个问题,因为我已经有了新的统计数据!
由于索引当前不可用,因此没有 SQL 查询使用该索引。当您收集统计信息(通过重建或dbms_stats包)时,所有针对基表的语句将在下次提交时重新解析(硬解析)。由于统计数据更新,计划可能会发生变化。
dbms_stats
因此,重建一个不可用的索引将使它对所有语句可见和可用,即使是那些先前已经解析过的语句。