Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.databases > #509
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!aioe.org!.POSTED!not-for-mail |
|---|---|
| From | Roedy Green <see_website@mindprod.com.invalid> |
| Newsgroups | comp.lang.java.databases |
| Subject | Searching for ranges |
| Date | Mon, 21 Nov 2011 08:56:45 -0800 |
| Organization | Canadian Mind Products |
| Lines | 45 |
| Message-ID | <nqukc7ta1mrd128h8tqbabo9k9e76eq7ak@4ax.com> (permalink) |
| Reply-To | Roedy Green <see_website@mindprod.com.invalid> |
| NNTP-Posting-Host | Z2l1DcCELS0rATq8NqV4Sw.user.speranza.aioe.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Complaints-To | abuse@aioe.org |
| X-Notice | Filtered by postfilter v. 0.8.2 |
| X-Newsreader | Forte Agent 6.00/32.1186 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.databases:509 |
Show key headers only | View raw
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. I wondered if there were standard solutions to the problem. The pattern of cases defined by bounds, particularly when the bounds are contiguous comes up quite frequently. I am surprised there are not more built in features in languages, Collections and databases to efficiently handle it. Some places where this band-searching problem comes up: converting a random number 0 <= r < 1 to select a weighted quotation. deciding which unit of measure to use depending on its size. deciding which rule to use for inserting dashes in a ISBN depending on is band. naming colours clipregion bands converting frequency to RGB UTF-8 encoding converting weight, height etc to evaluation words. calculations with coins. displaying a wide range of numbers or currency values. -- Roedy Green Canadian Mind Products http://mindprod.com I can't come to bed just yet. Somebody is wrong on the Internet.
Back to comp.lang.java.databases | Previous | Next — Next in thread | Find similar
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