Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cluster and Non cluster index in PostgreSQL

I'm using PostgreSQL 9.3 version to create database.

I have the following table test with some columns list.

create table test
(
  cola varchar(10),
  colb varchar(10),
  colc varchar(10),
  cold varchar(10)
);

Now I want to create a indexs on some columns.

For example:

I want to create clustered index for columns cola and colb.

And I want to create non clustered index for columns colc and cold.

As I referred this And this ,I come to know that there is no clustered and non clustered index in PostgreSQL.

My Question: What type of index I can use instead of clustered and non clustered index in PostgreSQL,Which does the same job as clustered and non clustered indexes does?

like image 300
MAK Avatar asked Jan 16 '15 06:01

MAK


1 Answers

My Question: What type of index I can use instead of clustered and non clustered index in PostgreSQL,Which does the same job as clustered and non clustered indexes does?

PostgreSQL doesn't have the concept of clustered indexes at all. Instead, all tables are heap tables and all indexes are non-clustered indexes.

Just create a non-clustered index when you'd usually create a clustered index.

More details:

  • http://use-the-index-luke.com/sql/clustering/index-organized-clustered-index
    You might want to read the whole chapter to get proper understanding of these concepts.
like image 200
Markus Winand Avatar answered Oct 03 '22 15:10

Markus Winand