Lists: | pgsql-hackers |
---|
From: | Alex Pilosov <alex(at)pilosoft(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | [PATCH] indexability of << operator for inet/cidr |
Date: | 2001-06-14 20:30:14 |
Message-ID: | Pine.BSO.4.10.10106141626270.17809-200000@spider.pilosoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Attached is a patch that explains to optimizer that its possible to use
index when performing a << b where a is an inet/cidr value and b is a
constant.
Indexpath generated for such an expression is this:
(a > network(b)) and (a <= set_masklen(broadcast(b, 32)))
Since this is my first time delving in the guts of postgres, someone
definitely should review it :)
I mostly based my code on prefix_quals function for string types.
Thanks
Attachment | Content-Type | Size |
---|---|---|
pg-index-inetsub.patch | text/plain | 7.3 KB |
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Alex Pilosov <alex(at)pilosoft(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [PATCH] indexability of << operator for inet/cidr |
Date: | 2001-06-14 23:03:23 |
Message-ID: | 23099.992559803@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Alex Pilosov <alex(at)pilosoft(dot)com> writes:
> Indexpath generated for such an expression is this:
> (a > network(b)) and (a <= set_masklen(broadcast(b, 32)))
What happens to that set_masklen thing for IPv6?
If the network.c code were exporting a function that made this value,
I'd not worry; but I don't like wiring an IPv4 assumption into code far
away in the planner. Can't we do better here? Perhaps move the
generation of the indexscan bound values into a subroutine in network.c?
regards, tom lane
From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Alex Pilosov <alex(at)pilosoft(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [PATCH] indexability of << operator for inet/cidr |
Date: | 2001-06-14 23:05:10 |
Message-ID: | 200106142305.f5EN5An01616@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Your patch has been added to the PostgreSQL unapplied patches list at:
http://candle.pha.pa.us/cgi-bin/pgpatches
I will try to apply it within the next 48 hours.
> Attached is a patch that explains to optimizer that its possible to use
> index when performing a << b where a is an inet/cidr value and b is a
> constant.
>
> Indexpath generated for such an expression is this:
> (a > network(b)) and (a <= set_masklen(broadcast(b, 32)))
>
> Since this is my first time delving in the guts of postgres, someone
> definitely should review it :)
>
> I mostly based my code on prefix_quals function for string types.
>
> Thanks
>
Content-Description:
[ Attachment, skipping... ]
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From: | Alex Pilosov <alex(at)pilosoft(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [PATCH] indexability of << operator for inet/cidr |
Date: | 2001-06-15 04:35:13 |
Message-ID: | Pine.BSO.4.10.10106150033311.17529-100000@spider.pilosoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, 14 Jun 2001, Tom Lane wrote:
> Alex Pilosov <alex(at)pilosoft(dot)com> writes:
> > Indexpath generated for such an expression is this:
> > (a > network(b)) and (a <= set_masklen(broadcast(b, 32)))
>
> What happens to that set_masklen thing for IPv6?
>
> If the network.c code were exporting a function that made this value,
> I'd not worry; but I don't like wiring an IPv4 assumption into code far
> away in the planner. Can't we do better here? Perhaps move the
> generation of the indexscan bound values into a subroutine in network.c?
Good point. I already rewrote it, but I am going to send it in tomorrow, I
want to resync to HEAD, since some of network.c was taken in and I want to
have a clean patch for you guys :)
Thanks
-alex
From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Alex Pilosov <alex(at)pilosoft(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [PATCH] indexability of << operator for inet/cidr |
Date: | 2001-06-15 13:56:45 |
Message-ID: | 200106151356.f5FDuj322159@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Patch removed from queue, awaiting updated version.
> Attached is a patch that explains to optimizer that its possible to use
> index when performing a << b where a is an inet/cidr value and b is a
> constant.
>
> Indexpath generated for such an expression is this:
> (a > network(b)) and (a <= set_masklen(broadcast(b, 32)))
>
> Since this is my first time delving in the guts of postgres, someone
> definitely should review it :)
>
> I mostly based my code on prefix_quals function for string types.
>
> Thanks
>
Content-Description:
[ Attachment, skipping... ]
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026