avoiding index on incremental column

Started by Tom DalPozzoover 9 years ago2 messagesgeneral
Jump to latest
#1Tom DalPozzo
t.dalpozzo@gmail.com

Hi,
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.

Regards
Pupillo

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Stephen Frost
sfrost@snowman.net
In reply to: Tom DalPozzo (#1)
Re: avoiding index on incremental column

* t.dalpozzo@gmail.com (t.dalpozzo@gmail.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