Relational Database Index Design and the Optimizers

1. Focus on the maor issues
    It is vital to focus on the few really major issues,
not on the relatively unimportant detail under which many people drown. This is
key—to focus on a very few, crucially important areas—and to be able to say
how long it would take or how much it would cost.

2. The size of the table pages sets an upper limit to the length of table rows. Normally, a table row must fit in one table page; an index row must fit in one leaf page. If the average length of the rows in a table is more than one third of the page size, space utilization suffers. Only one row with 2100 bytes fits in a 4K page, for instance. The problem of unusable space is more pronounced with indexes. As new index rows must be placed in a leaf page according to the index key value, the leaf pages of many indexes should have free space for a few index rows, after load and reorganization. Therefore, index rows that are longer than 20% of the leaf page may result in poor space utilization and frequent leaf page splits. 

3. Bitmap indexes consist of a bitmap (bit vector) for each distinct column value. Each bitmap has one bit for every row in the table. The bit is on if the related row has the value represented by the bitmap.
    Bitmap indexes make it feasible to perform. queries with complex and unpredictable compound predicates against a large table. This is because ANDing and ORing bitmap indexes is very fast, even when there are hundreds of millions of table rows. The corresponding operation with B-tree indexes requires collecting a large number of pointers and sorting large pointer sets.
    On the other hand a B-tree index, containing the appropriate columns, eliminates table access. This is important because random I/Os to a large table are very slow(about 10ms). With a bitmap index, the table rows must be accessed unless the SELECT list contains only COUNTs. Therefore, the total execution time using a bitmap index may be much longer than with a tailored, (fat) B-tree index. 
    Bitmap indexes should be used when the following conditions are true:
     1. The number of possible predicate combinations is so large that designing adequate B-tree indexes is not feasible.
     2. The simple predicates have a high filter factor, but the compound predicate(WHERE clause) has a low filter factor - or the SELECT list contains COUNTs only.
     3. The updates are batched(no lock contention). 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8520577/viewspace-760171/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8520577/viewspace-760171/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Relational databases have been around now for more than 20 years. In their early days, performance problems were widespread due to limited hardware resources and immature optimizers, and so performance was a priority consideration. The situation is very different nowadays; hardware and software have advanced beyond all recognition. It’s hardly surprising that performance is now assumed to be able to take care of itself! But the reality is that despite the huge growth in resources, even greater growth has been seen in the amount of information that is now available and what needs to be done with this information. Additionally, one crucial aspect of the hardware has not kept pace with the times: Disks have certainly become larger and incredibly cheap, but they are still relatively slow with regards to their ability to directly access data. Consequently many of the old problems haven’t actually gone away—they have just changed their appearance. Some of these problems can have enormous implications— stories abound of “simple” queries that might have been expected to take a fraction of a second appear to be quite happy to take several minutes or even longer; this despite all the books that tell us how to code queries properly and how to organize the tables and what rules to follow to put the right columns into the indexes. So it is abundantly clear that there is a need for a book that goes beyond the usual boundaries and really starts to think about why so many people are still having so many problems today.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值