<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://grasswiki.osgeo.org/w/index.php?action=history&amp;feed=atom&amp;title=SQLite_backend_vector_maps</id>
	<title>SQLite backend vector maps - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://grasswiki.osgeo.org/w/index.php?action=history&amp;feed=atom&amp;title=SQLite_backend_vector_maps"/>
	<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=SQLite_backend_vector_maps&amp;action=history"/>
	<updated>2026-04-03T17:56:59Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=SQLite_backend_vector_maps&amp;diff=24086&amp;oldid=prev</id>
		<title>Neteler: Extra tricks for power users</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=SQLite_backend_vector_maps&amp;diff=24086&amp;oldid=prev"/>
		<updated>2017-04-03T15:52:11Z</updated>

		<summary type="html">&lt;p&gt;Extra tricks for power users&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Separate SQLite database files for vector maps ==&lt;br /&gt;
&lt;br /&gt;
  IMPORTANT: Extra tricks for power users!&lt;br /&gt;
&lt;br /&gt;
Since SQLite does not support concurrent write access to its DB file ([https://sqlite.org/lockingv3.html reference]), '''parallelized vector map processing in a single mapset''' is hampered (&amp;quot;Busy SQLite&amp;quot; warnings).&lt;br /&gt;
&lt;br /&gt;
As a solution, instead of storing the vector attributes in a single SQLite database file in each mapset, individual SQLite files are to be created on a per-map basis. Simply running the next command will do the job to activate this behaviour. This can be run right after mapset creation:&lt;br /&gt;
&lt;br /&gt;
  db.connect driver=sqlite database='$GISDBASE/$LOCATION_NAME/$MAPSET/vector/$MAP/sqlite.db'&lt;br /&gt;
&lt;br /&gt;
Most (all?) of the v.db.* commands work with vector map specific database files. The db.* commands seemed work as well, if the database path is provided at the command line.&lt;br /&gt;
&lt;br /&gt;
=== Background info ===&lt;br /&gt;
&lt;br /&gt;
''Remarks by Sören Gebbert:''&lt;br /&gt;
&lt;br /&gt;
I skipped the sqlite directory in the vector map path ($MAP/sqlite/sqlite.db -&amp;gt; $MAP/sqlite.db), since this directory must be created when a new vector is opened, hence the vector-open-new functions must be modified to support a separate sqlite directory. With the simple solution the directory fsync() behavior of sqlite will force now all vector map specific files to be flushed to disc. This may be a performance problem.&lt;br /&gt;
&lt;br /&gt;
''Hints (by Markus Metz):''&lt;br /&gt;
&lt;br /&gt;
SQLite might not open the (new) database at all if it can not fsync() the directory. That will not result in performance penalty but in a fatal error, therefore it is a good idea to keep the sqlite db in a separate folder.&lt;br /&gt;
&lt;br /&gt;
The GRASS &amp;quot;sqlite&amp;quot; driver attempts to create the sqlite directory (db__driver_open_database() in trunk/db/driver/sqlite/db.c) if the directory does not exist, therefore Vect_open_new*() should not need any modification.&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
[https://lists.osgeo.org/pipermail/grass-dev/2016-September/082208.html Thread on GRASS-dev mailing list on the topic] (source of the information in this article)&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
[[Category:database]]&lt;br /&gt;
[[Category:vector]]&lt;/div&gt;</summary>
		<author><name>Neteler</name></author>
	</entry>
</feed>