db2的位图索引

DB2 的位图索引



Generally, DBAs ask the equivalent of Oracle's bitmap indexes in DB2. DB2 optimizer takes away the burden of creating / maintaining bitmap indexes as it creates them on the fly when it needs them.

一般来说,数据库管理员们要求DB2的位图索引与Oracle的相同。 DB2优化器承担了创建或维护位图索引的重担,当需要位图索引时它能迅速的创建出来。



How do you know if DB2 optimize is using bitmap index or not?

你该如何得知DB2优化是否正在使用位图索引呢?



David Sciaraffa explains that you can know about it by looking at the explain plan for the query. One of the example is shown below

David Sciaraffa解释说,你可以通过查看查询语句的‘执行计划’来了解情况。下面是一个实例:



FETCH

              /     \

        RIDSORT  fact table

         /

       IXAND   ----> This is where the "bitmaps" are ANDed

      /  |  \

  NLJN      NLJN

/   \  ... /   \  

D1   IF1    Dn   IFn

Note:

IF1 .. IFn are indexes on the fact table that provide

the RIDs used for the bitmap ANDing

D1 ...Dn are dimension tables .... could be accessed

in different ways.




Generally as a DBA, you might have created a bitmap index in Oracle on a low cardinality column but DB2 does this automatically for you.

作为一个数据库管理员,通常在Oracle中你也许需要在低基数列下创建位图索引,而DB2则可以自动创建。



The problem with static bit map indexes is - you require many of them and they impact the updating of data. An insert, update, delete needs to update all the indexes. DB2 researchers made a decision many years ago to go with dynamic bit map indexes.

静态位图索引的问题是,你需要有很多并且它们会影响数据的更新。每一次的插入、更新、删除都需要更新所有索引。 DB2研究人员在多年前就决定采用动态位图索引。



There is no disk or update overhead and DB2 can give you similar performance by accessing the index and handling the RIDS in memory. In addition to bitmap indexes, DB2 have hash joins which are lightening fast if you have the memory for them. Basically the same as bit map indexing.

不需要任何硬盘或更新开销,DB2可以给你相同的体验,仅仅通过访问索引和处理内存中的RIDS。除了位图索引,DB2还有哈希关联—如果你提供内存,它也会非常快。基本上和位图索引是相同的。

你可能感兴趣的:(oracle,db2,performance,Go)