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.