Re: Box query
- From: "Mikito Harakiri" <mikharakiri_nospaum@xxxxxxxxx>
- Date: 22 Apr 2006 18:30:24 -0700
Bob Badour wrote:
Mikito Harakiri wrote:
Bob Badour wrote:
If you take a look at the second-to-last step, your query failed before
it got to the having clause:
Let tmp1 = { (box1,box2,exp(sum(ln(...)))) |
(1,1,6), (1,2,3e-8),
(2,1,3e-8), (2,2,6)
}
All right, let's make the case condition symmetric:
having 1 = exp(sum(ln(
case when b2.low between b1.low and b1.high
*or* b1.low between b2.low and b2.high
then 1 else 0.00000001 end)))
Changing the having clause won't fix a problem that already happened
before the having clause is applied.
I'm changing the aggregation expression. Therefore, the result of
aggregation is different now:
Let tmp1 = { (box1,box2,exp(sum(ln(...*or*...)))) |
(1,1,1), (1,2,1),
(2,1,1), (2,2,1)
}
Anyway, the condition if the two intervals [b1.low,b1.high] and
[b2.low,b2.high] intersect (for each dimension) is a simple expression
that depends on 4 numbers. Kind of obvious, isn't it? All what is
needed is aggregating it with the product aggregate -- which
corresponds to informal idea of the intersection volume. Alternatively,
we operate with 1s and 0s only, and could use boolean conjunction,
which is arithmetic min aggregate.
.
- Follow-Ups:
- Re: Box query
- From: Bob Badour
- Re: Box query
- References:
- Box query
- From: Mikito Harakiri
- Re: Box query
- From: Mikito Harakiri
- Re: Box query
- From: Bob Badour
- Re: Box query
- From: Mikito Harakiri
- Re: Box query
- From: Mikito Harakiri
- Re: Box query
- From: Mikito Harakiri
- Re: Box query
- From: Bob Badour
- Re: Box query
- From: Mikito Harakiri
- Re: Box query
- From: Bob Badour
- Re: Box query
- From: Mikito Harakiri
- Re: Box query
- From: Bob Badour
- Box query
- Prev by Date: Re: efficient compare
- Next by Date: Re: Has E/R had a negative impact on db?
- Previous by thread: Re: Box query
- Next by thread: Re: Box query
- Index(es):
Relevant Pages
|