Category: The Clustering Factor

Character Strings-Datatypes

There are four basic character string types in Oracle, namely, CHAR, VARCHAR2, NCHAR, and NVARCHAR2. All of the strings are stored in the same format in Oracle. On the database block, they will have a leading length field of 1–3 bytes followed by the data; when they are NULL, they will be represented as a Read More

Auto Indexing Wrap-Up-Indexes

Does this mean the DBAs and application developers don’t need to worry about indexing anymore? Far from it. Even with automatic indexing, you still need to monitor the system and ensure that the indexing is doing what you think it should do. You’ll haveinsights into your database and application code that the auto indexing feature Read More

Why Isn’t My Index Getting Used?-Indexes-2

Case 4We have indexed a character column. This column contains only numeric data. We query using the following syntax:SQL> select * from t where indexed_column = 5 Note that the number 5 in the query is the constant number 5 (not a character string). The index on INDEXED_COLUMN is not used. This is because the Read More

Invisible Indexes-Indexes

You have the option of making an index invisible to the optimizer. The index is only invisible in the sense that the optimizer won’t use the index when creating an execution plan. You can either create an index as invisible or alter an existing index to be invisible. Here, we create a table, load it Read More

Function-Based Indexes Wrap-Up-Indexes

Function-based indexes are easy to use and implement, and they provide immediate value. They can be used to speed up existing applications without changing any of their logic or queries. Many orders of magnitude improvement may be observed. You can use them to precompute complex values without using a trigger. Additionally, the optimizer can estimate Read More

Multiple Indexes on the Same Column Combinations-Indexes

Prior to Oracle Database 12c, you could not have multiple indexes defined on one table with the exact same combination of columns. For example:$ sqlplus eoda/foo@PDB1SQL> create table t(x int);Table created.SQL> create index ti on t(x);Index created.SQL> create bitmap index tb on t(x) invisible; Starting with 12c, you can define multiple indexes on the same Read More

Function-Based Index Solution-Indexes

The concept here is that you’re building an index and applying a function to it in a way that limits the length of the index key and also results in a usable index. Here, I use the same code (as in the prior section) to create a table with an extended column and populate it Read More

Do Nulls and Indexes Work Together?-Indexes

BTree indexes, except in the special case of cluster BTree indexes, do not store completely null entries, but bitmap and cluster indexes do. This side effect can be a point of confusion, but it can actually be used to your advantage when you understand what not storing entirely null keys implies. To see the effect Read More

Why Isn’t My Index Getting Used?-Indexes-1

There are many possible causes of this. In this section, we’ll take a look at some of the most common. Case 1We’re using a B*Tree index, and our predicate does not use the leading edge of an index. In this case, we might have a table T with an index on T(x,y). We query SELECT Read More

Index Case Summary-Indexes

In my experience, these six cases are the main reasons I find that indexes are not being used. It usually boils down to a case of “They cannot be used—using them would return incorrect results,” or “They should not be used—if they were used, performance would be terrible.” Myth: Space Is Never Reused in an Read More

1 2