| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | KOPOSOV Sergey <Sergey(dot)Koposov(at)ed(dot)ac(dot)uk> |
| Cc: | "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: int8range and index usage for <@ operator |
| Date: | 2022-04-28 16:57:39 |
| Message-ID: | 23925.1651165059@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
KOPOSOV Sergey <Sergey(dot)Koposov(at)ed(dot)ac(dot)uk> writes:
> I'm trying to understand to is there a possibility to use an index for PG
> when I have a integer column in a table and I want to execute queries with this
> integer_column <@ int8range
> or
> integer_column <@ int8multirange
> in a where clause
There's no support for that at the moment. In principle the range
case could be converted to something like "integer_column >= lower_value
AND integer_column <= upper_value" by attaching a support function to
<@ and implementing the SupportRequestIndexCondition API. I think it
could only work for a plan-time-constant range though, else you'd not know
whether to use equality or inequality bounds. (Hmm ... or maybe, use
equality always and treat it as a lossy conversion? But infinite bounds
would still be a headache.)
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | KOPOSOV Sergey | 2022-04-28 17:06:28 | Re: int8range and index usage for <@ operator |
| Previous Message | JORGE MALDONADO | 2022-04-28 16:57:31 | Re: Backing up a DB excluding certain tables |