Re: avoiding index on incremental column

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: "t(dot)dalpozzo(at)gmail(dot)com" <t(dot)dalpozzo(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: avoiding index on incremental column
Date: 2016-10-17 15:49:13
Message-ID: 20161017154913.GX13284@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

* t(dot)dalpozzo(at)gmail(dot)com (t(dot)dalpozzo(at)gmail(dot)com) wrote:
> I've a very huge table whose 1st column is a numeric value, starting
> from 0 at the 1st row and incremented by 1 each new row I inserted.
> No holes, no duplicates.
> I need to perform some very fast query based on this value, mainly
> around the last inserted rows.
> What is the best I can do? A normal index or is there a way to
> instruct the system to take advantage from that strong order?
> In theory, the number of the row is the only info the system would
> need to directly access that row.
> So I'd like to avoid useless complex indexes if possible.

A BRIN index should work pretty well in that scenario.

A btree index would most likely be better/faster for query time, but
more expensive to maintain.

Thanks!

Stephen

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2016-10-17 19:09:02 Re: Generic way to test input arguments
Previous Message t.dalpozzo@gmail.com 2016-10-17 15:43:33 avoiding index on incremental column