Re: Creating indexes

From: PFC <lists(at)peufeu(dot)com>
To: "Rauan Maemirov" <rauan1987(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Creating indexes
Date: 2008-05-08 20:08:17
Message-ID: op.uaup73lxcigqcu@apollo13.peufeu.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> Hi, all. I want to ask what type of index is better to create for
> bigint types. I have table with bigint (bigserial) primary key. What
> type is better to use for it? I tried btree and hash, but didn't
> notice any differences in execution time. For GiST and GIN there is a
> trouble that I must create operator class, so I limited myself to use
> btree or hash. But if it's better to use gist or gin, coment are
> welcome.

If you use BIGINT, I presume you will have lots of different values, in
that case the best one is the btree. It is the most common and most
optimized index type.
GiST's strength is in using indexes for stuff that can't be done with a
simple btree : geometry, full text, ltree, etc, but gist is slower in the
case of indexing a simple value.
GIN indexes are more compact and very fast for reads but updating is very
slow (they are meant for mostly read-only tables).
Hash is a bit of a fossil. Also it does not support range queries, so if
you need that, btree is definitely better.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Rauan Maemirov 2008-05-09 05:41:22 Re: Creating indexes
Previous Message PFC 2008-05-08 20:02:47 Re: Creating a foreign key