Re: [PERFORM] Slow query: Select all buildings that have >1 pharmacies and >1 schools within 1000m

2012-08-09 Thread Jeff Janes
On Thu, Aug 9, 2012 at 4:00 AM, Stefan Keller wrote: > Hi > > 2012/8/8 Jeff Janes : >> On Tue, Aug 7, 2012 at 5:07 PM, Stefan Keller wrote: >>> Hi Craig >>> >>> Clever proposal! >>> I slightly tried to adapt it to the hstore involved. >>> Now I'm having a weird problem that PG says that "relation

Re: [PERFORM] Slow query: Select all buildings that have >1 pharmacies and >1 schools within 1000m

2012-08-09 Thread Stefan Keller
Hi 2012/8/8 Jeff Janes : > On Tue, Aug 7, 2012 at 5:07 PM, Stefan Keller wrote: >> Hi Craig >> >> Clever proposal! >> I slightly tried to adapt it to the hstore involved. >> Now I'm having a weird problem that PG says that "relation 'p' does not >> exist". >> Why does PG recognize table b in the

Re: [PERFORM] Slow query: Select all buildings that have >1 pharmacies and >1 schools within 1000m

2012-08-07 Thread Jeff Janes
On Tue, Aug 7, 2012 at 5:07 PM, Stefan Keller wrote: > Hi Craig > > Clever proposal! > I slightly tried to adapt it to the hstore involved. > Now I'm having a weird problem that PG says that "relation 'p' does not > exist". > Why does PG recognize table b in the subquery but not table p? > Any id

Re: [PERFORM] Slow query: Select all buildings that have >1 pharmacies and >1 schools within 1000m

2012-08-07 Thread Stefan Keller
Hi Craig Clever proposal! I slightly tried to adapt it to the hstore involved. Now I'm having a weird problem that PG says that "relation 'p' does not exist". Why does PG recognize table b in the subquery but not table p? Any ideas? -- Stefan SELECT b.way AS building_geometry FROM (SELECT way

Re: [PERFORM] Slow query: Select all buildings that have >1 pharmacies and >1 schools within 1000m

2012-08-07 Thread Craig James
On Tue, Aug 7, 2012 at 5:01 AM, Stefan Keller wrote: > Hi > > I have an interesting query to be optimized related to this one [1]. > > The query definition is: Select all buildings that have more than 1 > pharmacies and more than 1 schools within a radius of 1000m. > > The problem is that I think

Re: [PERFORM] Slow query: Select all buildings that have >1 pharmacies and >1 schools within 1000m

2012-08-07 Thread Tomas Vondra
On 7 Srpen 2012, 14:22, Stefan Keller wrote: > Your proposal lacks the requirement that it's the same building from > where pharmacies and schools are reachable. > But I think about. I don't know the dataset so I've expected the osm_id to identify the building - then the intersect should work as A

Re: [PERFORM] Slow query: Select all buildings that have >1 pharmacies and >1 schools within 1000m

2012-08-07 Thread Stefan Keller
Your proposal lacks the requirement that it's the same building from where pharmacies and schools are reachable. But I think about. Yours, S. 2012/8/7 Tomas Vondra : > On 7 Srpen 2012, 14:01, Stefan Keller wrote: >> Hi >> >> I have an interesting query to be optimized related to this one [1]. >>

Re: [PERFORM] Slow query: Select all buildings that have >1 pharmacies and >1 schools within 1000m

2012-08-07 Thread Tomas Vondra
On 7 Srpen 2012, 14:01, Stefan Keller wrote: > Hi > > I have an interesting query to be optimized related to this one [1]. > > The query definition is: Select all buildings that have more than 1 > pharmacies and more than 1 schools within a radius of 1000m. > > The problem is that I think that this

[PERFORM] Slow query: Select all buildings that have >1 pharmacies and >1 schools within 1000m

2012-08-07 Thread Stefan Keller
Hi I have an interesting query to be optimized related to this one [1]. The query definition is: Select all buildings that have more than 1 pharmacies and more than 1 schools within a radius of 1000m. The problem is that I think that this query is inherently O(n^2). In fact the solution I propos