Re: How to use the BRIN index properly?

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: Siddharth Jain <siddhsql(at)gmail(dot)com>
Cc: Ron <ronljohnsonjr(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How to use the BRIN index properly?
Date: 2023-02-08 21:20:05
Message-ID: 4CCC40F6-D1FF-4446-B50C-26A8843E6EE4@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Feb 8, 2023, at 13:17, Siddharth Jain <siddhsql(at)gmail(dot)com> wrote:
>
> As I explained in my question that is indeed our dilemma. Our insertion order will not be equal to index order. i.e., referring to your response:
>
> > who's data is added in the same order as the key in the BRIN index
>
> does NOT hold.

A BRIN index is not a good choice in this case. You can CLUSTER the data on an index, but that's a one-time operation: PostgreSQL will not maintain that order after the CLUSTER. If the number of rows in the table at the time of the CLUSTER is much larger than the number that are inserted between CLUSTER operations, then a BRIN index might be useful, but clustering a very large table is an expensive operation, and requires an exclusive lock on the table while it is being done.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrus 2023-02-08 21:37:26 Re: How to create directory format backup
Previous Message Erik Wienhold 2023-02-08 21:17:58 Re: How to create directory format backup