Re: [postgis-users] Performance external loop, WHERE IN (values), stored procedure or else to pass data to SQL query

2016-06-23 Thread Michal Seidl
Hi, thanks for advice. CTE looks like the solution for me. I did not measure any performance but it is obviously better than test each point in a loop. M On 06/13/2016 08:46 PM, Leknín Řepánek wrote: Python Array -> geometry(POINT, [SRID])[] -> unnest, you can use unnest in CTE something

Re: [postgis-users] Performance external loop, WHERE IN (values), stored procedure or else to pass data to SQL query

2016-06-16 Thread Paul Norman
On 6/14/2016 3:53 AM, Michal Seidl wrote: With other operators ST_Distance,ST_Equal, = the spatial index is not used (?) and query take about 500ms. 500 points x 500ms => 250s which is quite a lot and I do not take into account time spent on python side. That's the problem. Do everything in

Re: [postgis-users] Performance external loop, WHERE IN (values), stored procedure or else to pass data to SQL query

2016-06-16 Thread Rémi Cura
Index not used can have a lot of causes: 1. the way you write the sql query, 2. a problem with statistics (vacuum analyze concerned tables) 3. a wrong tuning of postgres server (less common) ... Most likely in your case is 1., but you can vacuum analyze the tables first, it could be an easy fix.

Re: [postgis-users] Performance external loop, WHERE IN (values), stored procedure or else to pass data to SQL query

2016-06-14 Thread Michal Seidl
Hello, You understand my problem correctly. But despite I have sptatial index on geometry colum (points are 2D) one SQL query takes about 20ms only with operator && ST_GeomFromText('POINT..) && geom_column. This operator as I know works only with MBR (it should be same as equal for points)

[postgis-users] Performance external loop, WHERE IN (values), stored procedure or else to pass data to SQL query

2016-06-13 Thread Michal Seidl
Hello, I have probably simple question but I am stuck. I have table with about 1E6 points in table. I have about hundreds of points in Python array. How to pass these points into Postgis SQL query to check against table (if the same point exist) with millions points? I started with Python loop to