Re: JOINing based on whether an IP address is contained within a CIDR range?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: JOINing based on whether an IP address is contained within a CIDR range?
Дата
Msg-id 23757.1193340735@sss.pgh.pa.us
обсуждение исходный текст
Ответ на JOINing based on whether an IP address is contained within a CIDR range?  ("Jamie Tufnell" <diesql@googlemail.com>)
Список pgsql-sql
"Jamie Tufnell" <diesql@googlemail.com> writes:
> Is it possible to somehow JOIN using the <<= and
> = network operators?

Sure, why not?

You probably won't get a plan that's smarter than a nestloop, but I
imagine you'll have few enough rows in network_names that it won't
matter.

One potential problem is if there could be overlapping entries in
network_names --- the join would give you multiple rows for any
log entry that matches more than one network_names entry.  You
could fix that using a subselect with LIMIT 1, as long as you
weren't too picky about which name got reported.
        regards, tom lane


В списке pgsql-sql по дате отправления:

Предыдущее
От: Erik Jones
Дата:
Сообщение: Re: JOINing based on whether an IP address is contained within a CIDR range?
Следующее
От: Darnell Brawner
Дата:
Сообщение: hidden versioning system