Poor performance in inet << cidr join

From: Axel Rau <Axel(dot)Rau(at)Chaos1(dot)DE>
To: pgsql-sql(at)postgresql(dot)org
Subject: Poor performance in inet << cidr join
Date: 2005-10-31 18:53:57
Message-ID: a366b1ecc7f4d6f4b139106cf524f2e7@Chaos1.DE
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi SQLers,

in 8.0, joining 2 tables:

CREATE TABLE network (
id cidr PRIMARY KEY , -- 'PK, ,IPv4/6 Network address'
...
)
CREATE TABLE address (
id inet PRIMARY KEY , -- 'PK of IPv4/6 host address'
...
)
as:
SELECT COUNT(*) FROM address A
WHERE NOT EXISTS (
SELECT A.id FROM network N WHERE A.id << N.id );
shows this query plan:
Aggregate (cost=2264.51..2264.51 rows=1 width=0)
-> Seq Scan on address a (cost=0.00..2225.86 rows=15459 width=0)
Filter: (NOT (subplan))
SubPlan
-> Seq Scan on network n (cost=0.00..107.95 rows=2038
width=0)
Filter: ($0 << (id)::inet)

The planner does not use the pk-indices. Poking around,
I could not find an operator class, which supports the containment
('<<') operator.
Is my conclusion correct?
How can the functionality be extended?
Is there any implementation available?

Thanks, Axel
Axel Rau, Frankfurt, Germany +49-69-951418-0

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message lucas 2005-10-31 19:58:27 Re: Fwd: Re: Referencing
Previous Message Thomas Good 2005-10-31 18:28:01 JOIN condition confusion