From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeremy Finzel <finzelj@gmail.com>
Cc: Postgres General <pgsql-general@postgresql.org>
Subject: Re: Aggregate not using BRIN index on timestamp
Date: Mon, 05 Aug 2019 10:20:30 -0400
Message-ID: <12589.1565014830@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMa1XUhGWTdDEx51RGZU7pU6T77QUtY-fn1HjYB9cGb2B=yrTQ@mail.gmail.com>
References: <CAMa1XUhGWTdDEx51RGZU7pU6T77QUtY-fn1HjYB9cGb2B=yrTQ@mail.gmail.com>
Jeremy Finzel <finzelj@gmail.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, finzelj@gmail.com
Subject: Re: Aggregate not using BRIN index on timestamp
In-Reply-To: <12589.1565014830@sss.pgh.pa.us>
References: <CAMa1XUhGWTdDEx51RGZU7pU6T77QUtY-fn1HjYB9cGb2B=yrTQ@mail.gmail.com> <12589.1565014830@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox