Partitions and High Water Mark in Oracle

ぐ巨炮叔叔 提交于 2020-01-04 03:41:55

问题


High Water Mark (HWM) for a table in an Oracle Database is the line between blocks that have been used and ones that have never been. Truncating a table resets the HWM to zero.

Now, if I have a partitioned table, I'd like to know if the following is true:

  1. Does each partition maintain its own HWM?
  2. If not, does alter table ... drop partition ... affect table's HWM?

The idea is I'd like to populate partition's tables with insert /*+ append */ (direct path insert), but it only writes data beyond the HWM, so will the space be reused if I recreate the partition? I failed to find information on this specific aspect.


回答1:


Each partition is a separate segment, so each would have its own HWM. I presume that truncating the whole table would reset the HWM for all partitions. You can truncate individual partitions as well, which certainly would reset the HWM for the partition.




回答2:


In addition to Dave Costa's answer, response to second question: If you truncate the partition, the HWM will be at zero, so the space will be regained for direct path insert(space will be used). If you drop the partition, the space will be free for any other segment to be used. In particular, for your new partition.

So, in fewer words:

  • if you truncate the partition, space will be available for this partition.
  • if you drop the partition, the space will be free and usable for every segment in the tablespace.

Also, another trick to use if you want to reuse the space is to do an alter table move partition. This will "recreate" the partition, without loosing the data. There are more details, but this is your question about.



来源:https://stackoverflow.com/questions/9924838/partitions-and-high-water-mark-in-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!