Re: Aggregate not using BRIN index on timestamp

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeremy Finzel <finzelj(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Aggregate not using BRIN index on timestamp
Date: 2019-08-05 14:20:30
Message-ID: 12589.1565014830@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeremy Finzel <finzelj(at)gmail(dot)com> writes:
> I have a very large table with 4 billion rows and a BRIN index on timestamp
> spanning from 2013 to present. I am running this simple query:
> SELECT MIN(created_at) FROM table;
> It is choosing a parallel seq scan as opposed to a BRIN bitmap scan.

> I can provide more info. But first - am I missing something obvious?

Yes: BRIN indexes don't provide any ordering information. A btree
index on created_at could be used to optimize this query, but without
one of those, seqscanning the whole table is the only possibility.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeremy Finzel 2019-08-05 15:10:06 Re: Aggregate not using BRIN index on timestamp
Previous Message Tom Lane 2019-08-05 13:51:38 Re: why toasted is created when domain is used ?