Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.databases > #510

Re: Searching for ranges

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.databases
Subject Re: Searching for ranges
Date 2011-11-21 21:18 +0000
Organization UK Free Software Network
Message-ID <jaef7t$r47$1@localhost.localdomain> (permalink)
References <nqukc7ta1mrd128h8tqbabo9k9e76eq7ak@4ax.com>

Show all headers | View raw


On Mon, 21 Nov 2011 08:56:45 -0800, Roedy Green wrote:

> I was wondering about techniques for using SQL to find records with a
> low-high associated range, especially when the ranges are contiguous, or
> when the range sizes are a multiple of some integer.
> 
> I am familiar with in-RAM technique such as binary search and dividing
> by the range size/atomicity to get an index.
> 
> I suspect just asking for  table.low <= wanted < table.high won't be
> that clever, even if low and high are indexed.
>
Au contraire, that should be pretty good given a decent RDBMS, provided 
that:

- a frequency analysis is done to ensure that the costs of maintaining
  the index don't damage the performance of other queries.

- the query using the new index isn't so complex that the effect of the
  index becomes irrelevant or even harmful. EXPLAIN is your friend here
  for PostgreSQL and some other DBMS. Those that don't implement 
  EXPLAIN should provide a similar tool. If the DBMS you're using
  doesn't, consider carefully if you should be using it for anything.
  

-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.lang.java.databases | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Searching for ranges Roedy Green <see_website@mindprod.com.invalid> - 2011-11-21 08:56 -0800
  Re: Searching for ranges Martin Gregorie <martin@address-in-sig.invalid> - 2011-11-21 21:18 +0000
  Re: Searching for ranges David Lee Lambert <davidl@lmert.com> - 2012-01-17 11:59 -0800
    Re: Searching for ranges Roedy Green <see_website@mindprod.com.invalid> - 2012-01-19 09:32 -0800

csiph-web