暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

What is table fragmentation, and should I worry about it ?

2011-01-01
904

The Oracle (tm) Users' Co-Operative FAQ

What is table fragmentation, and should I worry about it ?


Author's name: Norman Dunbar

Author's Email: Oracle@bountifulsolutions.co.uk

Date written: 18/02/2002

Oracle version(s): 7.3.4 onwards

What is table fragmentation, and should I worry about it ?


What is table fragmentation?

Table fragmentation is the situation that develops when a table has been created with an INITIAL and NEXT extent sizes which are too small for the amount of data that is subsequently loaded into the table. In essence, the table ends up with a large number of extents rather than just a few.

Should I worry about it?

Short answer, no.

Quote from Practical Oracle 8i by Jonathan Lewis, Page 150 : Let's start by reviewing one of the oldest myths, and biggest wastes of DBA time, in the Oracle book of legends. Someone once said, "You get better performance if each object is stored in a single extent." It must be well over 10 years ago that Oracle published a white paper exploding this myth, and yet the claim lingers on.

The white paper referred to is (probably) How to stop defragmenting and start living: The definitive word on fragmentation by Himatsingka and Loaiza which describes the SAFE methodology for storage allocation. SAFE is Simple Algorithm For Fragmentation Elimination. In this white paper they explain how testing has shown that under normal circumstances, Oracle can quite happily handle segments which have many thousands of extents.

Of course, when dropping or truncating a segment which has many extents, each extent will have to be de-allocated and the dictionary updated and this will have a degrading effect on performance.

Steve Adams of www.ixora.com.au fame, goes on to clarify and extend the SAFE system a little in his article on managing extents. (See below in further reading). From Steve's article, it appears that allowing the number of extents to exceed 500 (for an 8K block) will cause cluster chaining in the dictionary. This will then have an effect on allocating and deallocating extents.

Summary

  • Don't worry about having more than one extent in a table.
  • Try to keep the number of extents to a managable limit - I personally follow Steve Adams advice and keep extents around the 500 mark.
  • Try to keep segmnents of a similar size and 'hit rate' together in separate tablespaces.
  • Don't spend your life exporting and importing table to get them back into a single extent - it really isn't worth it !

Further reading:

SAFE - How to stop defragmenting and start living
www.ixora.co.au - Planning Extents
Practical Oracle 8i - Building efficient Databases by Jonathan Lewis. Published by Addison Wesley. ISBN 0-201-71584-8



【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论