Clustered Database vs Non-clustered Database#

  • There are two types of sql databases clustered(innodb, mysql) and non-clustered(postgres).

  • In clustered databases, by default we need to provide a primary key column, upon providing, it will automatically maps the entire row with that primary key -> p_key: entire_row in the real harddisk.

  • Secondary indexes in clustered databases is used to create index for other columns, where it maps secondary_index: primary_key in the real harddisk.

  • In non-clustered databases, each row will be stored randomly in the harddisk, and then there is a separate table for storing that pointer with primary_key which also stored in the real harddisk.