在MS SQL 中,铁人(SQL 2005性能调优)建议我们一般的表最好都要有聚集索引,就是ORACLE 的IOT表,
在ORACLE 中,TOM教导我们一般的表99%最好都是堆表(heap table).
(摘自Expert_Oracle_Database_Architecture_Oracle_Database_Programming_9i_10g_and_11g_Techniques_and_Solutions
--PAGE 324)这是为什么呢? 希望各位牛人解惑.
个人倾向于 是表最好都是聚集索引表(IOT)表,更加合适.当然这也不是绝对.难道ORACLE OLTP的应用场景都是只查单条记录?都不需要顺序读取?

解决方案 »

  1.   

    对于除主键外其他字段较少,最好是一个的建立iot比较好,其他的最好还是建普通表,数据量过大的最好做分区表.
      

  2.   

    在ORACLE中,顺序就是按照主键的顺序是不?在MS SQL 中是可以不按主键,可以按其他任意字段来排序存储的.如业务单据的时间.对于很多时候来说,我们都希望看一小段时间内的数据库.如一天内.这里只是一个比方,而且MS SQL 中有个聚集对其它的影响相对不大.我在MS SQL 版问这个问题,有人认为我是看ORALCE的看错了,哈你能告诉我用IOT表的危害吗? 如增删改数据的时候,导致数据重新排序存储.
    对于我的考量来说,读到索引即读到数据,而堆表还要有个指向,这样不是相对还慢一拍了吗?
      

  3.   

    oracle的自然排序是按rowid的,或者说是按存储位置的.如果要取某种排序的数据,必须使用order by来排序
      

  4.   

    iot的表数据排序一般也不会变吧,我是指两条记录的相对先后位置.
    因为更新主键是数据库中比较忌讳的操作,一般都不对主键进行更改的.
      

  5.   

    确认下,iot=index organised table
      

  6.   

    如果需求排序就按表就按IOT的顺序的话,对IOT来说就有很大的帮助了哦iot=index organised table
    对应的MS SQL 就是 clustered index table 
    不过ORACLE 的这个index 好像代表的是主键,是不?
      

  7.   

    恩,必须是主键,下面是文档
    Use the index_org_table_clause to create an index-organized table. Oracle Database maintains the table rows, 
    both primary key column values and nonkey column values, in an index built on the primary key. 
    Index-organized tables are therefore best suited for primary key-based access and manipulation. An index-organized table is an alternative to:
    A noncluster table indexed on the primary key by using the CREATE INDEX statement
    A cluster table stored in an indexed cluster that has been created using the CREATE CLUSTER statement 
    that maps the primary key for the table to the cluster keyYou must specify a primary key for an index-organized table, because the primary key uniquely identifies a row. 
    The primary key cannot be DEFERRABLE. 
    Use the primary key instead of the rowid for directly accessing index-organized rows.If an index-organized table is partitioned and contains LOB columns, then you should specify the index_org_table_clause first, 
    then the LOB_storage_clause, and then the appropriate table_partitioning_clauses.You cannot use the TO_LOB function to convert a LONG column to a LOB column in the subquery of a CREATE TABLE ... AS SELECT statement 
    if you are creating an index-organized table. Instead, create the index-organized table without the LONG column, 
    and then use the TO_LOB function in an INSERT ... AS SELECT statement.
      

  8.   

    iot的排序应该是按主键升序的.
    因为iot实际是把非键字段也放到了index里存储,所以对iot的查询类似对index的查询.默认是主键的升序