It's All About ORACLE

Oracle - The number one Database Management System. Hope this Blog will teach a lot about oracle.

Some Important fact about Indexes


About Indexes:
Indexes are special lookup tables that the database search engine can use to speed up data retrieval. Simply put, an index is a pointer to data in a table. An index in a database is very similar to an index in the back of a book.

For example, if you want to reference all pages in a book that discuss a certain topic, you first refer to the index, which lists all topics alphabetically and are then referred to one or more specific page numbers.

An index helps speed up SELECT queries and WHERE clauses, but it slows down data input, with UPDATE and INSERT statements. Indexes can be created or dropped with no effect on the data.

Important Facts:

1. Order Index Columns for Performance:

The order of columns in the CREATE INDEX statement can affect query performance. In general, specify the most frequently used columns first.

If you create a single index across columns to speed up queries that access, for example, col1, col2, and col3; then queries that access just col1, or that access just col1 and col2, are also speeded up. But a query that accessed just col2, just col3, or just col2 and col3 does not use the index.

2. Limit the Number of Indexes for Each Table:-

A table can have any number of indexes. However, the more indexes there are, the more overhead is incurred as the table is modified. Specifically, when rows are inserted or deleted, all indexes on the table must be updated as well. Also, when a column is updated, all indexes that contain the column must be updated.

Thus, there is a trade-off between the speed of retrieving data from a table and the speed of updating the table. For example, if a table is primarily read-only, having more indexes can be useful; but if a table is heavily updated, having fewer indexes could be preferable.

3. Drop Indexes That Are No Longer Required:

Consider dropping an index if:
-> It does not speed up queries. The table could be very small, or there could be many rows in the table but very few index entries.
-> The queries in your applications do not use the index.
-> The index must be dropped before being rebuilt.

4. Estimate Index Size and Set Storage Parameters:

Estimating the size of an index before creating one can facilitate better disk space planning and management. You can use the combined estimated size of indexes, along with estimates for tables, the undo tablespace, and redo log files, to determine the amount of disk space that is required to hold an intended database. From these estimates, you can make correct hardware purchases and other decisions.

Use the estimated size of an individual index to better manage the disk space that the index uses. When an index is created, you can set appropriate storage parameters and improve I/O performance of applications that use the index. For example, assume that you estimate the maximum size of an index before creating it. If you then set the storage parameters when you create the index, fewer extents are allocated for the table data segment, and all of the index data is stored in a relatively contiguous section of disk space. This decreases the time necessary for disk I/O operations involving this index.

The maximum size of a single index entry is approximately one-half the data block size.

5. Specify the Tablespace for Each Index:

Indexes can be created in any tablespace. An index can be created in the same or different tablespace as the table it indexes. If you use the same tablespace for a table and its index, it can be more convenient to perform database maintenance (such as tablespace or file backup) or to ensure application availability. All the related data is always online together.

Using different tablespaces (on different disks) for a table and its index produces better performance than storing the table and index in the same tablespace. Disk contention is reduced. But, if you use different tablespaces for a table and its index and one tablespace is offline (containing either data or index), then the statements referencing that table are not guaranteed to work.

6. Consider Parallelizing Index Creation:

You can parallelize index creation, much the same as you can parallelize table creation. Because multiple processes work together to create the index, the database can create the index more quickly than if a single server process created the index sequentially.

When creating an index in parallel, storage parameters are used separately by each query server process. Therefore, an index created with an INITIAL value of 5M and a parallel degree of 12 consumes at least 60M of storage during index creation.

When NOT to create Index:

1. When you need to fetch most of the data from a table. 
2. When table is small, doesn't contain too many rows.
3. When there are so many NULL values.
4. When Cardinality is low then you can choose bitmap, else do not create index.
5. When your table has too much DML operations like INSERT, UPDATE. Indexes can create trouble in such situation.

4 comments:

Searching for the Best Dating Site? Create an account and find your perfect date.

 

Submit your blog or website now for indexing in Google and over 300 other search engines!

Over 200,000 websites listed!

SUBMIT RIGHT NOW via I NEED HITS!!!

 

BlueHost is ultimately the best web-hosting company for any hosting services you might need.

 

Grab free website marketing tools at TrafficHeap.

 

You Might Also Like

Related Posts with Thumbnails

Pages