pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Yonatan Ben-Nes <da@canaan.co.il>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Cristian Prieto <cristian@clickdiario.com>
Cc: Sean Davis <sdavis2@mail.nih.gov>
Cc: pgsql-general@postgresql.org
Cc: pgsql-performance@postgresql.org
Subject: Re: Index use in BETWEEN statement...
Date: Tue, 27 Sep 2005 13:45:41 +0200
Message-ID: <433930E5.7090800@canaan.co.il> (raw)
In-Reply-To: <1896.1127762243@sss.pgh.pa.us>
References: <20050926175615.BA5C21015A@mail.clickdiario.com>
	<1896.1127762243@sss.pgh.pa.us>

Tom Lane wrote:
> "Cristian Prieto" <cristian@clickdiario.com> writes:
> 
>>mydb=# explain analyze select locid from geoip_block where
>>'216.230.158.50'::inet between start_block and end_block;
> 
> 
>>As you see it still using a sequential scan in the table and ignores the
>>index, any other suggestion?
> 
> 
> That two-column index is entirely useless for this query; in fact btree
> indexes of any sort are pretty useless.  You really need some sort of
> multidimensional index type like rtree or gist.  There was discussion
> just a week or three ago of how to optimize searches for intervals
> overlapping a specified point, which is identical to your problem.
> Can't remember if the question was about timestamp intervals or plain
> intervals, but try checking the list archives.
> 
> 			regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
> 
>                http://archives.postgresql.org

I think that Tom is talking about a discussion which I started entitled 
"Planner create a slow plan without an available index" search for it 
maybe it will help you.
At the end I created an RTREE index and it did solved my problem though 
my data was 2 INT fields and not INET fields as yours so im not sure how 
can you work with that... To solve my problem I created boxes from the 2 
numbers and with them I did overlapping.



view thread (8+ messages)

Message-ID: <433930E5.7090800@canaan.co.il>
Permalink:  ../433930E5.7090800@canaan.co.il/
Also on:    postgresql.org/message-id/433930E5.7090800@canaan.co.il

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: da@canaan.co.il, tgl@sss.pgh.pa.us, cristian@clickdiario.com, sdavis2@mail.nih.gov, pgsql-general@postgresql.org
  Subject: Re: Index use in BETWEEN statement...
  In-Reply-To: <433930E5.7090800@canaan.co.il>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox