Features of Oracle Bitmap Index

Tue, 08 Sep 2009 18:58:07 +0800

A bitmap index is a special kind of database index that uses bitmaps.

 

Bitmap indexes have traditionally been considered to work well for data which has a small number of distinct values but with many occurrences, such as column region on table person, only with values East, North, West or South but each of them has many occurrences.

 

However, some researchers argue that Bitmap indexes are also useful for unique valued data which is not updated frequently. Bitmap indexes have a significant space and performance advantage over other structures for such data.

 

Read more

Oracle Index: Bitmap index and B-tree index

Tue, 08 Sep 2009 18:40:32 +0800

        Oracle has 2 kinds of Index: B-tree index and Bitmap Index.

 

        B-Tree indexes are the regular type that OLTP systems make much use of, and bitmap indexes are a highly compressed index type that tends to be used primarily for data warehouses.

 

        An index provides pointers to the rows in a table that contain a given key value. A regular index stores a list of rowids for each key corresponding to the rows with that key value. In a bitmap index, a bitmap for each key value replaces a list of rowids.

        Each bit in the bitmap corresponds to a possible rowid, and if the bit is set, it means that the row with the corresponding rowid contains the key value. A mapping function converts the bit position to an actual rowid, so that the bitmap index provides the same functionality as a regular index. If the number of different key values is small, bitmap indexes save space.

        Bitmap indexes are most effective for queries that contain multiple conditions in the WHERE clause. Rows that satisfy some, but not all, conditions are filtered out before the table itself is accessed. This improves response time, often dramatically.

Read more

Reducing Loop's Time Cost with Bulk Binds

Wed, 02 Sep 2009 21:53:38 +0800

As the following figure shows, during the execution of a PL/SQL block, the PL/SQL engine executes procedural statements but sends SQL statements to the SQL engine, which executes the SQL statements and, in some cases, returns data to the PL/SQL engine. 

 

So when a PL/SQL block including a loop, which causes frequently transfer between PL/SQL engine and SQL engine, the time cost is quite high and the efficiency is really low.

For example:

DECLARE
   TYPE NumList IS VARRAY
(20) OF NUMBER;
   depts NumList := NumList
(10, 30, 70)-- department numbers
BEGIN
   ...
   FOR i IN depts.FIRST..depts.LAST LOOP
      DELETE FROM emp WHERE deptno = depts
(i);
   END LOOP;
END;

The above DELETE statement is sent to the SQL engine with each iteration of the FOR loop. Too many context switches between the PL/SQL and SQL engines and it can harm performance. So, what should we do to improve the performance? Use Bulk Binds!

Read more

PL/SQL Interview Questions

Mon, 31 Aug 2009 20:05:00 +0800

  1. Difference between implicit cursor and explicit cursor.

An explicit cursor is a named query that is defined as a cursor in PL/SQL by use of  the keyword CURSOR . UPDATE, DELETE and INSERT statements always use an implicit cursor.

The difference between explicit and implicit cursors in Oracle PLSQL is that explicit cursors give you complete control over opening, closing and fetching from an explicit cursor, including the number of rows fetched. Also, fetching from an explicit cursor will never raise a NO_DATA_FOUND or a TOO_MANY_ROWS exception.

When using implicit cursors in Oracle PL/SQL, we access the cursor attributes by prefixing the attribute name with "SQL%". To access the cursor attributes of explicit cursors in Oracle PL/SQL the SQL keyword is replaced by the cursor name.

 

Another advantage of using explicit named cursors in PL/SQL is that they can be parameterised just like any procedure or function

Read more

Named System Exceptions

Thu, 27 Aug 2009 22:34:11 +0800

What is a named system exception?

Named system exceptions are exceptions that have been given names by PL/SQL. They are named in the STANDARD package in PL/SQL and do not need to be defined by the programmer.

Oracle has a standard set of exceptions already named as follows:

Read more

Drive into Android

Wed, 26 Aug 2009 06:47:53 +0800

Android is a software stack for mobile devices that includes an operating system, middleware and key applications. The Android SDK provides the tools and APIs necessary to begin developing applications that run on Android-powered devices.You can find more information here.

Read more

Oracle System Tables

Mon, 24 Aug 2009 22:43:53 +0800

An alphabetical listing of the Oracle system tables that are commonly used.

Read all

Introduction to ADF Data Visualization Components

Fri, 21 Aug 2009 00:51:28 +0800

In this tutorial, you've seen how to create a tabbed JSF Page and use some ADF DVT graphical features. 1>Create a Master Detail page. 2>Add a Bar Chart. 3>Add a Gauge Chart. 4>Add Geographical Info. 5>Create a Pivot Table. 6>Create a Gantt Chart.

Read all

Getting Started with Oracle JDeveloper 11g and ADF Rich Client. Instructions of How to Install JDeveloper 11g and A Sample of Oracle ADF Rich Client Application includes "Implementing Partial Page Rendering"、"Adding Pop up Functionality to the Page"、"Adding Drag and Drop Functionality to the Page " and so on.

Read all

Unix Shell 学习笔记(一)

Fri, 14 Aug 2009 19:44:23 +0800

1.1 基本命令 >显示时间和日期:date >查看登入系统用户:who >显示字符:echo 1.2 文件操作 >列出文件清单:ls >显示文件内容: cat >统计文件中的单词数: wc >复制文件: cp >文件重命名: mv >删除文件: rm 1.3 目录操作 >显示当前工作目录: pwd >改变当前工作目录: cd >创建目录: mkdir >链接文件: ln >删除目录: rmdir 1.4文件名替换 >*可以替换0个或者以上的字符, ?可以匹配一个字符。 1.5 标准输入/输出及重定向 1.6 管道 1.7 标准错误 1.8 有关命令的输入讨论 >一行键入多个命令, 命令间用; 分隔。>命令发送到后台。 >ps 命令

Read all