Index usage for elem-contained-by-const-range clauses

From: Pritam Baral <pritam(at)pritambaral(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Index usage for elem-contained-by-const-range clauses
Date: 2017-02-22 23:17:02
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers

The topic has been previously discussed[0] on the -performance mailing list,
about four years ago.

In that thread, Tom suggested[0] the planner could be made to "expand
"intcol <@
'x,y'::int4range" into "intcol between x and y", using something similar
to the
index LIKE optimization (ie, the "special operator" stuff in indxpath.c)".

This patch tries to do exactly that. It's not tied to any specific datatype,
and has been tested with both builtin types and custom range types. Most
of the
checking for proper datatypes, operators, and btree index happens before
code, so I haven't run into any issues yet in my testing. But I'm not
enough with the internals to be able to confidently say it can handle
all cases
just yet.


#!/usr/bin/env regards
Chhatoi Pritam Baral

Attachment Content-Type Size
use-btree-index-in-elem-contained-by-range.patch text/x-patch 6.7 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2017-02-22 23:24:49 Re: Change in "policy" on dump ordering?
Previous Message Corey Huinker 2017-02-22 23:15:01 Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)