From: Віталій Тимчишин <tivv00@gmail.com>
To: Matthew Wakeling <matthew@flymine.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: Very specialised query
Date: Fri, 27 Mar 2009 18:36:50 +0200
Message-ID: <331e40660903270936u5db00807sb1169df66443ade3@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.0903261313290.21772@aragorn.flymine.org>
References: <alpine.DEB.2.00.0903261313290.21772@aragorn.flymine.org>
Hello.
You could try adding "AND l2.start > l1.start" to the first query. This
will drop symmetric half of intersections (the ones that will remain are l2
inside or to the left of l1), but you can redo results by
id1,id2 union all id2, id1 and may allow to use start index for "between",
for my "like" test this looks like the next:
" -> Index Scan using location__start on location l2 (cost=0.00..756.34
rows=37787 width=12)"
" Index Cond: ((l2.start < l1.eend) AND (l2.start > l1.start))"
also an index on (objectid, start) would help resulting in :
" -> Index Scan using lt on location l2 (cost=0.00..0.84 rows=20
width=16)"
" Index Cond: ((l2.objectid = l1.objectid) AND (l2.start < l1.eend)
AND (l2.start > l1.start))"
Best regards,
Vitalii Tymchyshyn
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: tivv00@gmail.com, matthew@flymine.org
Subject: Re: Very specialised query
In-Reply-To: <331e40660903270936u5db00807sb1169df66443ade3@mail.gmail.com>
References: <alpine.DEB.2.00.0903261313290.21772@aragorn.flymine.org> <331e40660903270936u5db00807sb1169df66443ade3@mail.gmail.com>
* 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