On Fri, 27 Mar 2009, Marc Mamin wrote:
if your data are mostly static and you have a few mains objects,
maybe you can have some gain while defining conditional indexes for those plus 
one for the rest
and then slicing the query:

Maybe. I thought about doing that. However, I am not convinced that would be much of a gain, and would require major rewriting of the queries, as you suggest.

WHERE (l2.start BETWEEN  l1.start AND l1.end
         OR
         l1.start BETWEEN  l2.start AND l2.end
         )

Yes, that's another way to calculate an overlap. However, it turns out to not be that fast. The problem is that OR there, which causes a bitmap index scan, as the leaf of a nested loop join, which can be rather slow.

Matthew

--
I'd try being be a pessimist, but it probably wouldn't work anyway.
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Reply via email to