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

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 a GIST

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

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

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 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

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 either of the

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 = great

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

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 well as

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't any

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-compliant back

[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