Re: BUG #9833: daterange is not utilizing index correctly - Mailing list pgsql-bugs

From Greg Stark
Subject Re: BUG #9833: daterange is not utilizing index correctly
Date
Msg-id CAM-w4HMjQgkQhuoZL_q5bJBU_oYd33=CYdXqe4qghuLZaanBUg@mail.gmail.com
Whole thread Raw
In response to Re: BUG #9833: daterange is not utilizing index correctly  (bricklen <bricklen@gmail.com>)
Responses Re: BUG #9833: daterange is not utilizing index correctly  (Shahar <shaharhd@gmail.com>)
List pgsql-bugs
On 3 Apr 2014 21:39, "bricklen" <bricklen@gmail.com> wrote:
>

> 1). [1978-07-15,1983-03-01) means "include 1978-07-15 and everything up
to - but not including - 1983-03-01", whereas BETWEEN is inclusive.

That means we can't simply rewrite the with as a BETWEEN clause. However
conceptually btree could be extended to handle @> operators like this.

This is a perfectly reasonable feature request but it's just not something
btree can handle currently. Btree operator classes can handle a few
specific operators <, <=, =, >=, and > and that's it I believe. Adding more
is non trivial work and range data types are fairly new.

> 2). I haven't tested, but wouldn't you need to create a GiST index for <@
to use the index?
> 3). Related to #2, have you tried installing the btree_gist extension to
allow the query planner to use the index?

Gist is more flexible about adding new operators. I don't know if that
means it has this one though. If it does you would have to build a new
index using the btree_gist operator class which is may not be worth it's
weight in your database.

pgsql-bugs by date:

Previous
From: harukat@sraoss.co.jp
Date:
Subject: BUG #9849: walreceiver's DEBUG message reports wrong timestamp
Next
From: Michael Paquier
Date:
Subject: Re: BUG #9841: Need some help in sql query