Re: CIDR index use for '<<' operator

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kendall Koning" <kkoning(at)egl(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: CIDR index use for '<<' operator
Date: 2000-10-05 06:31:23
Message-ID: 28089.970727483@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Kendall Koning" <kkoning(at)egl(dot)net> writes:
> Postgres doesn't seem to make use of indexes when doing operations with the
> CIDR '<<' (contains) operator.

You're right --- the system has no idea that the '<<' operator has any
relationship to the sort ordering of CIDR indexes.

Seems like it'd be possible to improve this along the same lines that
we use to make LIKE and regexp matches indexable: derive lower and
upper bounds on the CIDR variable from a 'cidr-var << cidr-constant'
clause, and use those to create 'cidr-var >= lower-bound AND
cidr-var <= upper-bound' indexscan limit clauses.

If you feel like tackling this, the "special index operator" support
in src/backend/optimizer/path/indxpath.c is the stuff that'd need to
be extended.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nina Kuznetsova 2000-10-05 07:51:46 undefined reference
Previous Message Tim Uckun 2000-10-05 06:24:41 VIEW problem