2 Haziran 2023 Cuma

Clustered vs Non-clustered indexes

Clustered Index
Primary Key anlamına gelir gibi düşünülebilir. Açıklaması şöyle.  
Clustered and non-clustered indexes
The primary key index is also a clustered index, and the non-primary key index is non-clustered. 
Bazı veri tabanlarında Clustered Index ile tüm satıra erişilebiliyor. Açıklaması şöyle
... when you lookup the key, and get to a leaf page, you will find the full row with all its columns. This is what is referred to as clustered index. 
Postgres böyle değil. Açıklaması şöyle
All indexes including the primary index in Postgres are secondary, they all point to the row identifier.

The row identifier in Postgres, aka the tuple id, is the unique identifier in Postgres. It is a combination of the page number in the table file and position of the tuple in that page, making it unique.

What is fascinating about the tuple id is its not indexed, it gets you the row directly with a simple, often one, I/O.

Non-Clustered Index
CREATE INDEX ile yaratılır

Hiç yorum yok:

Yorum Gönder