Thanks to visit codestin.com
Credit goes to postgrespro.com

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

From [email protected] (George Siganos)
Subject Re: Question about a CIDR based query
Date
Msg-id [email protected]
Whole thread Raw
In response to Question about a CIDR based query  (Georgos Siganos <[email protected]>)
Responses Re: Question about a CIDR based query
List pgsql-sql
I did a vacuum analyze before I run the following explain 

June_03=# explain select * from tmp where route >>='62.1.1.0/24';                          QUERY PLAN
       
 
----------------------------------------------------------------Seq Scan on tmp  (cost=0.00..606.60 rows=14544
width=33) Filter: (route >>= '62.1.1.0/24'::cidr)
 
(2 rows)

The select returns just one route,
Thanks

[email protected] (Josh Berkus) wrote in message news:<[email protected]>...
> Georgos,
> 
> > select * from tmp where route >>= some_cidr
> 
> Can you post an EXPLAIN ANALYZE for this?   And when's the last time you ran 
> ANALYZE on the table?
> 
> > The index on route is not used and I get a sequential scan. The index is
> > used only for the <<= operator.
> 
> Most likely Postgres thinks that the >>= query is returning 60% of your table, 
> which makes indexes useless.
> 
> -- 
> Josh Berkus
> Aglio Database Solutions
> San Francisco
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faqs/FAQ.html


pgsql-sql by date:

Previous
From: "Phil Endecott"
Date:
Subject: Re: Need indexes on inherited tables?
Next
From: Karsten Hilbert
Date:
Subject: Re: Need indexes on inherited tables?