Open benducke opened 1 month ago
This is appropriate, if:
Not sure if this hint is helpful (and it requires a SQLite/PG/MySQL backend): encapsulating SQL statements into a TRANSACTION
notably speeds up the SQL backend processing:
BEGIN TRANSACTION
...
<SQL commands here>
....
END TRANSACTION
Python example:
Shell example:
Thanks! I completely forgot about SQL transactions. This gives a nice speed-up, especially when collating SQL statements before feeding them to the DBMS.
The use of v.db.select is also very common in all models support by v.net.models: These commonly reduce network connections by querying some sort of link attributes first.
Replacing this:
VAL=
v.db.select map="${input}" layer="1" columns="${field_name}" where="${condition}" -c --quiet``With this:
VAL=
db.select database="${atts_db}" sql="SELECT ${field_name} FROM ${input} WHERE ${condition};" -c --quiet``... will give a speed-up of almost 60% for minimal refactoring effort!