Re: [PERFORM] Help optimizing a slow index scan

2006-03-18 Thread Oleg Bartunov
On Fri, 17 Mar 2006, Evgeny Gridasov wrote: Try contrib/btree_gist. contrib/btree_gist does nothing more than built-in btree - it's just an support for multicolumn GiST indices. I've tried that one, but for my case it didn't help much. The performance was almost equal or even slower than bu

Re: [PERFORM] Help optimizing a slow index scan

2006-03-18 Thread Evgeny Gridasov
Try contrib/btree_gist. I've tried that one, but for my case it didn't help much. The performance was almost equal or even slower than built-in btree. On Fri, 17 Mar 2006 08:53:44 -0700 Dan Harris <[EMAIL PROTECTED]> wrote: > Dan Harris wrote: > > Markus Bertheau wrote: > >> Have you tried using

Re: [PERFORM] Help optimizing a slow index scan

2006-03-18 Thread Bruno Wolff III
On Sat, Mar 18, 2006 at 11:50:48 +0300, Oleg Bartunov wrote: > I may be wrong but we in astronomy have several sky indexing schemes, which > allows to effectively use classical btree index. See > http://www.sai.msu.su/~megera/oddmuse/index.cgi/SkyPixelization > for details. Sergei Koposov has d

Re: [PERFORM] Help optimizing a slow index scan

2006-03-18 Thread Oleg Bartunov
I may be wrong but we in astronomy have several sky indexing schemes, which allows to effectively use classical btree index. See http://www.sai.msu.su/~megera/oddmuse/index.cgi/SkyPixelization for details. Sergei Koposov has developed Q3C contrib module for PostgreSQL 8.1+ and we use it with bil

Re: [PERFORM] Help optimizing a slow index scan

2006-03-17 Thread Michael Fuhr
On Fri, Mar 17, 2006 at 11:41:11PM -0500, Tom Lane wrote: > Dan Harris <[EMAIL PROTECTED]> writes: > > Furthermore, by doing so, I am tying my queries directly to > > "postgres-isms". One of the long term goals of this project is to be > > able to fairly transparently support any ANSI SQL-compli

Re: [PERFORM] Help optimizing a slow index scan

2006-03-17 Thread Tom Lane
Dan Harris <[EMAIL PROTECTED]> writes: > Furthermore, by doing so, I am tying my queries directly to > "postgres-isms". One of the long term goals of this project is to be > able to fairly transparently support any ANSI SQL-compliant back end > with the same code base. Unfortunately, there isn

Re: [PERFORM] Help optimizing a slow index scan

2006-03-17 Thread Merlin Moncure
On 3/17/06, Dan Harris <[EMAIL PROTECTED]> wrote: > Merlin Moncure wrote: > Thanks to everyone for your suggestions. One problem I ran into is that > apparently my version doesn't support the GIST index that was > mentioned. "function 'box' doesn't exist" ).. So I'm guessing that both > this as w

Re: [PERFORM] Help optimizing a slow index scan

2006-03-17 Thread Dan Harris
Merlin Moncure wrote: As others will probably mention, effective queries on lot/long which is a spatial problem will require r-tree or gist. I don't have a lot of experience with exotic indexes but this may be the way to go. One easy optimization to consider making is to make an index on eithe

Re: [PERFORM] Help optimizing a slow index scan

2006-03-17 Thread Merlin Moncure
On 3/17/06, Bruno Wolff III <[EMAIL PROTECTED]> wrote: > Have you looked at using the Earth Distance contrib module? If a spherical > model of the earth is suitable for your application, then it may work for you > and might be easier than trying to create Gist indexes yourself. earth distance = gr

Re: [PERFORM] Help optimizing a slow index scan

2006-03-17 Thread Bruno Wolff III
On Fri, Mar 17, 2006 at 08:34:26 -0700, Dan Harris <[EMAIL PROTECTED]> wrote: > Markus Bertheau wrote: > >Have you tried using a GIST index on lat & long? These things are > >meant for two-dimensional data, whereas btree doesn't handle > >two-dimensional data that well. How many rows satisfy eith

Re: [PERFORM] Help optimizing a slow index scan

2006-03-17 Thread Merlin Moncure
On 3/16/06, Dan Harris <[EMAIL PROTECTED]> wrote: > explain analyze > select distinct eventmain.incidentid, eventmain.entrydate, > eventgeo.long, eventgeo.lat, eventgeo.geox, eventgeo.geoy > from eventmain, eventgeo > where > eventmain.incidentid = eventgeo.incidentid and > ( long > -104.99

Re: [PERFORM] Help optimizing a slow index scan

2006-03-17 Thread Dan Harris
Dan Harris wrote: Markus Bertheau wrote: Have you tried using a GIST index on lat & long? These things are meant for two-dimensional data, whereas btree doesn't handle two-dimensional data that well. How many rows satisfy either of the long / lat condition? According to the analyze, less

Re: [PERFORM] Help optimizing a slow index scan

2006-03-17 Thread Dan Harris
Markus Bertheau wrote: Have you tried using a GIST index on lat & long? These things are meant for two-dimensional data, whereas btree doesn't handle two-dimensional data that well. How many rows satisfy either of the long / lat condition? According to the analyze, less than 500 rows mat

Re: [PERFORM] Help optimizing a slow index scan

2006-03-16 Thread Dan Harris
Dan Harris wrote: explain analyze doh.. sorry to reply to my own post. But I messed up copying some of the fields into the select statement that you'll see in the "Sort Key" section of the analyze results. The mistake was mine. Everything else is "normal" between the query and the plan

[PERFORM] Help optimizing a slow index scan

2006-03-16 Thread Dan Harris
explain analyze select distinct eventmain.incidentid, eventmain.entrydate, eventgeo.long, eventgeo.lat, eventgeo.geox, eventgeo.geoy from eventmain, eventgeo where eventmain.incidentid = eventgeo.incidentid and ( long > -104.998027962962 and long < -104.985957781349 ) and ( lat > 39.707