Re: btree/gist index on date and searching using BETWEEN or >= and <=

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Wells Oliver <wells(dot)oliver(at)gmail(dot)com>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: btree/gist index on date and searching using BETWEEN or >= and <=
Date: 2023-09-12 00:08:14
Message-ID: 2697607.1694477294@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Wells Oliver <wells(dot)oliver(at)gmail(dot)com> writes:
> Is there a meaningful difference index/plan-wise searching where DATE
> BETWEEN x AND y versus DATE >= x AND DATE <= y?

Nope.

> Secondly, would btree be the best index for such a column, or gist/etc?

btree. gist can sort of do scalar-inequality searches, but they're
not its strength.

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Rui DeSousa 2023-09-12 00:51:38 Re: percentile_cont from array?
Previous Message Wells Oliver 2023-09-11 22:19:06 btree/gist index on date and searching using BETWEEN or >= and <=