Question about a CIDR based query - Mailing list pgsql-sql

From Georgos Siganos
Subject Question about a CIDR based query
Date
Msg-id ebba5a930406241343173046c7@mail.gmail.com
Whole thread Raw
Responses Re: Question about a CIDR based query
List pgsql-sql
Hello,

Consider that I have the following table:

Create Table tmp(
            route_id     int    NOT NULL,
            route         cidr   NOT NULL,
            Data         varchar(100) NOT NULL)

The table contains ~40,000 routes and I have an index on route.

The query I am interested in is:

select * from tmp where route >>= some_cidr

The index on route is not used and I get a sequential scan. The index is
used only for the <<= operator.

Any idea how I can make  the query run faster?

Thanks,
George


pgsql-sql by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: feature request ?
Next
From: "Phil Endecott"
Date:
Subject: Re: Normalising an existing table - how?