Sie sind auf Seite 1von 2

A database index is a data structure that improves the speed of data retrieval o

perations on a database table at the cost of slower writes and increased storage
space

Types
[edit] Bitmap index
Main article: Bitmap index
A bitmap index is a special kind of index that stores the bulk of its data as bi
t arrays (bitmaps) and answers most queries by performing bitwise logical operat
ions on these bitmaps. The most commonly used index, such as B+trees, are most e
fficient if the values it indexes do not repeat or repeat a smaller number of ti
mes. In contrast, the bitmap index is designed for cases where the values of a v
ariable repeat very frequently. For example, the gender field in a customer data
base usually contains two distinct values: male or female. For such variables, t
he bitmap index can have a significant performance advantage over the commonly u
sed trees.
[edit] Dense index
A dense index in databases is a file with pairs of keys and pointers for every r
ecord in the data file. Every key in this file is associated with a particular p
ointer to a record in the sorted data file. In clustered indexes with duplicate
keys, the dense index points to the first record with that key.[2]
[edit] Sparse index
A sparse index in databases is a file with pairs of keys and pointers for every
block in the data file. Every key in this file is associated with a particular p
ointer to the block in the sorted data file. In clustered indexes with duplicate
keys, the sparse index points to the lowest search key in each block.
[edit] Reverse index
Main article: Reverse index
A reverse key index reverses the key value before entering it in the index. E.g.
, the value 24538 becomes 83542 in the index. Reversing the key value is particu
larly useful for indexing data such as sequence numbers, where new key values mo
notonically increase.

SQL CREATE INDEX Syntax

CREATE INDEX <index_type> <index_name> ON <table_name> (


<column_name1> <index_order>,
<column_name2> <index_order>,
)

CREATE UNIQUE INDEX <index_type> <index_name> ON <table_name> (


<column_name1> <index_order>,
<column_name2> <index_order>,
SQL DROP INDEX Syntax

DROP INDEX <table_name>.<index_name>


a view consists of a stored query accessible as a virtual table composed of the
result set of a query. Unlike ordinary tables (base tables) in a relational data
base, a view does not form part of the physical schema: it is a dynamic, virtual
table computed or collated from data in the database. Changing the data in a ta
ble alters the data shown in subsequent invocations of the view.
Database practitioners can define views as read-only or updatable. If the databa
se system can determine the reverse mapping from the view schema to the schema o
f the underlying base tables, then the view is updatable. INSERT, UPDATE, and DE
LETE operations can be performed on updatable views. Read-only views do not supp
ort such operations because the DBMS cannot map the changes to the underlying ba
se tables. A view update is done by key preservation.

SQL CREATE VIEW Syntax

CREATE VIEW <view_name> (


<column_name1>,
<column_name2>
) AS
<sql_select_statement>

Das könnte Ihnen auch gefallen