Introduction to Bitmap Indexes

What is a bitmap index?

A bitmap index is a special type of index designed for efficient query processing on multiple keys. It is a binary valued two-dimensional array created with an indexed column for every record in the table. Bitmap indexes use bit arrays (commonly called bitmaps) and answer queries by performing bitwise logical operations on these bitmaps. As the number of distinct values increases, the size of the bitmap increases exponentially.  The bit in a row of bitmap is “1” if the record has the value v for the indexed attribute, or “0” otherwise.

Example:

bitmap_index_example

To create a bitmap index in Oracle:

CREATE BITMAP INDEX <indexname> ON
<table>
 (x, y);

Advantage of Bitmap Indexes

One belief concerning bitmap indexes is that they are only suitable for indexing low-cardinality data. This is not necessarily true, and bitmap indexes can be used successfully for indexing columns with many thousands of different values.

You use bitmaps predominantly when you want to merge together many of them at run time and there is no sensible way to B-Tree index them. For example: in an ad-hoc query environment where the users might pick any N columns out of M and query on them – no way to B-Tree index them – but you could create a series of single column bitmaps that we’ll merge together using AND/OR’s to create a new bitmap index on the fly to find your rows. Just like B-Tree indexes, bitmap indexes are best leveraged when the combination of them makes it very selective (returns only a small number of rows).

It is for this reason that bitmap indexes are largely used in data warehousing environments. OLAP environments typically have large amounts of data and ad-hoc queries but a low level of concurrent DML transactions. For such applications, bitmap indexing provides:

  • Reduced response time for large classes of ad-hoc queries
  • Reduced storage requirements compared to other indexing techniques
  • Dramatic performance gains even on hardware with a relatively small number of CPUs or a small amount of memory
  • Efficient maintenance during parallel DML and loads

Fully indexing a large table with a traditional B-Tree index can be prohibitively expensive in terms of space because the indexes can be several times larger than the data in the table. Bitmap indexes are typically only a fraction of the size of the indexed data in the table. In ad-hoc queries and similar situations, bitmap indexes can dramatically improve query performance. AND/OR conditions in the WHERE clause of a query can be resolved quickly by performing the corresponding Boolean operations directly on the bitmaps before converting the resulting bitmap to rowids. If the resulting number of rows is small, the query can be answered quickly without resorting to a full table scan.

Bitmap indexes are also useful in data warehousing applications for joining a large fact table to smaller dimension tables such as those arranged in a star schema.

Disadvantage of Bitmap Indexes

If your tables are not read-only during query time, do NOT use bitmap indexes!

Coming a close second to the “rebuild indexes regularly” myth is the “a column with a small number of distinct values is a good candidate for a bitmap index” legend. The reason for confining bitmap indexes to data warehouses is that the overhead on maintaining them is enormous. A modification to a bitmap index is significantly more expensive on behalf of the system than a modification to a B-Tree index. In addition, the concurrency for modifications on bitmap indexes is dreadful. Therefore they are not suitable for write-intensive environments.

The classic example of using a bitmap index on a gender column (male/female) is a horrible one in my opinion. If there are only two values, and there is an even distribution of data, 50% selectivity is too large and thus not a good candidate for a bitmap index. Would you use any index to access 50% of a table?

If a session modifies the indexed data, then all of the rows that index entry points are effectively locked in most cases. Oracle cannot lock an individual bit in a bitmap index entry; it locks the entire bitmap index entry. Any other modifications that need to update the same bitmap index entry will be locked out.

Is it fair to say that Vergil represents Aeneas as a passive follower of fate in The Aeneid?

The concepts of fate and destiny are fundamental components of Roman mythology and culture. These themes are intrinsic in Vergil’s poem, The Aeneid; the cornerstone of Roman literature. As the son of the Trojan Prince Anchises, and Venus, the goddess of love, Aeneas is the protagonist in Vergil’s Aeneid. Aeneas is destined to survive the siege of Troy and to establish a new state in Italy for the subsequent glory of the Roman Empire. Aeneas subordinates his feelings to the will of the gods and fate in his journey to Italy, and consequently Aeneas’ personal desire to duty define his character and thus earn him the moniker ‘pious Aeneas’ (Casali 2010, p.39).  Although Aeneas is portrayed to be a passive follower of fate, Vergil crafts Aeneas to be a worthy hero of the epic which bears his name.
 

Fate is the overarching theme that is present in the Aeneid. Before evaluating the intricate relationship between Aeneas’ actions and his preordained fate, it is imperative to understand the purpose of this specific literary device in the Aeneid. Arguably, Roman mythology was derived from the Greeks; the Roman gods merely adopted Romanized names (Roman 2010, p.291). The Romans were keen to reinterpret stories about the Greek deities under the names of their Roman counterparts. Among the key beliefs and traditions, the idea of fate was largely influential. In the Greek tradition, fate was the path which a person’s life was meant to travel; and ultimately the course could not be avoided (Roman 2010, p. 302). For instance, a classic Greek example is the tragic tale of Oedipus (Sophocles, Oedipus Rex). In the Aeneid, similar notions of fate guide Aeneas to his promised land. Aeneas’s actions in relation to fate are distinctive amongst the main characters. Juno, Turnus, and Mezentius act in opposition to the fated order of events and suffer the will of the gods; while Aeneas acts in harmony and cooperates with destiny. Hence Vergil utilises the concept of fate in the Aeneid to express that the origins of Rome were fated and therefore divinely mandated.
Continue reading

Is it possible to argue that the Roman slaves were respected as human beings?

Roman Italy was understood to be a ‘slave society’ considering slaves comprised twenty-percent of the population (Hopkins, 1978, p.99). It is arguable whether Roman slaves were respected as human beings, despite their low level status in society. In this essay, I will examine the claim by analysing the complex relationships between slaves and the citizens of Rome and also the economical impact of slavery. It is important to note that one of the key issues in this essay is the concept of cultural relativism. The Roman’s customs, beliefs and ethics are relative to their own time period and culture. Morality in the twenty-first century cannot be compared with Roman morality, since the notions of “right” and “wrong” are culture specific. When analysing the concept of slavery in antiquity, it is imperative to take into account that a slave’s fate is inextricably bound by the social hierarchy of power. In such a hierarchy, without the under-class there is simply no upper-class.

Many slaves lived in complete conditions of trust alongside their masters and mistresses (Rawson, 2010, p.24). The writings of several Roman authors illustrate the notion that slaves were considered by some citizens to be human beings instead of commodities. In a letter to his friend Lucilius, Seneca the Younger articulates a high level of respect towards slaves; stating that slaves and their respective masters are equal, as the fate of both social classes are effectively intertwined:

“I am glad to learn, through those who come from you, that you live on friendly terms with your slaves. This befits a sensible and well-educated man like yourself. “They are slaves,” people declare. Nay, rather they are men. “Slaves!” No, comrades. “Slaves!” No, they are unpretentious friends. “Slaves!” No, they are our fellow-slaves, if one reflects that Fortune has equal rights over slaves and free men alike.”
(Seneca the Younger, Moral Letters to Lucilius 47.1)

Continue reading

The Ten Commandments of Rational Debate

Various similar lists of the 10 commandments of rational debate have been posted thousands of times on the net, and today it is my turn to post a list of commandments.

1. Do not attack the person or his character, but only the argument itself. (“Ad hominem”)

2. Do not misrepresent or exaggerate a person’s argument in order to make their argument easier to attack. (“Straw Man Fallacy”)

3. Do not reduce the argument down to only two possibilities. (“False Dichotomy”)

4. Do not claim that just because something has occurred before something else then it must be the cause of the second thing. (“Post Hoc/False Cause”)

5. Do not argue your position by assuming one of its premises is true. (“Begging the Question”)

6. Do not claim that because a premise or argument is popular then it must be true. (“Bandwagon Fallacy”)

7. Do not argue that because of our ignorance at this point in time that your claim must be true or false. (“Ad Ignorantiam”)

8. Do not assume “this” follows “that,” when there is no logical connection. (“Non sequitur”)

9. Do not appeal to an outside “experts” to claim support. (“Appeal to Authority”)

10. Do not claim moral authority as support for your argument. (“Moral high ground fallacy”)