[GRASS-user] points in polygon query

Hamish hamish_nospam at yahoo.com
Tue May 22 22:59:53 EDT 2007


Maciej wrote:
> Last time I checked that it was circa 20 (twenty) times faster for
> me. Sorry no exact benchmarks.

The speed difference will be linearly proportional to the (fewer) number
of db.execute calls.

The overhead of starting db.execute, establishing the connection with
the DB, executing the SQL command, closing the program takes some time.
For arguments sake say that takes roughly 1/20th of a second. More than
20 calls or so and you start to notice the difference. If you have
db.execute inside of two nested for-loops, you're going to be creating
and ripping down a lot more than ~20 db.execute processes.


> The whole big idea is to take the db.execute out of the loop, collect
> all SQL commands within this loop into a text file and then feed the
> file into "db.execute input=" in the end, which executes all your SQL
> commands in one run.

Right. Move whatever slow stuff you can out of the loop.


Hamish




More information about the grass-user mailing list