30 Aralık 2022 Cuma

CREATE INDEX HASH_INDEX

Giriş
Şeklen şöyle. Aynı hash değerine sahip satırlar linked list gibi bağlanıyor


HASH CODE
Açıklaması şöyle
Despite the b-tree index, which can store many values without reducing the expected performance, the hash index has a limit of 2³²-1 of unique hash codes (different values may have the same hash codes). Therefore, increasing the number of duplicates (in terms of hash codes) negatively affects the index performance.
EQUALITY OPERATOR
Açıklaması şöyle
One of the reasons why the b-tree index is so standard is its flexibility because it supports all comparison operators. Hash index, on the other hand, supports only equality operators.
Bazı olumsuz yönleri şöyle
  • Limited search capabilities: Hash indexes are designed to handle only equality searches (i.e., “find all records where column A equals a specific value”). They are not well-suited for range queries or sorting.
  • Collisions: Hash indexes can have collisions, where multiple keys map to the same hash value. This can result in degraded performance, as the database must perform additional operations to resolve the collisions.
  • Unpredictable storage requirements: The size of a hash index cannot be predicted in advance, as it depends on the number of unique values in the indexed column. This can make it difficult to plan for storage requirements.
Örnek
Şöyle yaparız
CREATE TABLE IF NOT EXISTS hash_table(example varchar);

CREATE INDEX IF NOT EXISTS hash_index ON hash_table USING hash(example);

Hiç yorum yok:

Yorum Gönder