Database Reference
In-Depth Information
It is also worth noting that indexes on memory-optimized tables do not get stored
on disk and are also not reflected in the checkpoint, data, and delta files. Also,
index operations do not get logged to the transaction log. Indexes are automatically
maintained when data modification statements are made on them much like their
disk-based counterpart but in the event of a server restart, memory-optimized table
indexes will get rebuilt.
Data storage for memory-optimized tables differs completely from its disk-based
counterparts. Traditional pages are not used and the space is not allocated from
extents. This is due to the design making use of the byte addressable memory.
Rows are allocated from a structure called a heap. This heap is different from
the traditional disk-based heaps you associate with SQL Server tables with no
clustered index created on them. Rows for a single table are not necessarily stored
contiguously, that is, near other rows from the same table. The only way SQL Server
understands which rows belong to the same table is through the index, since all
rows are connected using the tables' indexes. Hence, the need and requirement of
memory-optimized tables is an index. Each row will consist of a header and payload
that contain the row attributes.
The row header will consist of two 8-byte fields that hold In-Memory OLTP
timestamps called Begin-Ts and End-Ts. The value of Begin-Ts represents the
timestamp of the transaction that inserted the row, and the End-Ts value represents
the timestamp for the transaction that deleted the row. If a row has not been deleted,
then its End-Ts value is set to a special value known as infinity. The header will
also contain a 4-byte statement ID value. Every statement within a transaction
has a unique StmtId value, and when a row is created, it stores the StmtId for the
statement that created the row. If the same statement accesses the same row again, it
can be skipped. The header contains a 2-byte value (idxLinkCount), which represents
a reference count indicating how many indexes reference this row. The payload area
is the row itself containing all the columns in the row including the key column,
which in effect means that all indexes are covering indexes. A covering index is an
index that contains all the data needed to satisfy the query.
Hash indexes are a type of index that can be used for memory-optimized tables.
Hash indexes are basically an array of pointers. A hash index consists of a collection
of buckets or containers organized in an array. A function is used to map the
corresponding index keys to the containers in the hash index. The following diagram
is meant to show how the hash function is used to determine which function contains
the index key:
 
Search WWH ::




Custom Search