-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SpatiaLite index issue #23024
Comments
Author Name: Reinhard Reiterer (Reinhard Reiterer)
|
Author Name: Jukka Rahkonen (Jukka Rahkonen) The issue is real but how to improve the current situation needs some thinking because spatial index in SpatiaLite/GeoPackage is not an index but a table with some well known triggers. The list of true indexes from SQLite can be obtained with a PRAGMA command @pragma index_list('table_name')@ I suppose that the Indexes tab in Layer properties makes exactly that request. From SpatiaLite databases created with recent versions the existence of the spatial index is supposed to be checked from the geometry columns table which has a column "spatial_index_enabled". @select ROWID, "f_table_name", "f_geometry_column", "type", "coord_dimension", "srid", "spatial_index_enabled" If user is pressing "Create spatial index" button and spatial index already exists then the application should perhaps make a question: For the GeoPackage case I suppose that if spatial index exists or not should be checked with the test that is included in the standard, on page 75: @A.3.1.3 Spatial Indexes ...snip...
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Giovanni Manghi (@gioman) End of life notice: QGIS 2.18 LTR Source:
|
@tschmetzer gdrive? wetransfer? dropbox? |
https://drive.google.com/file/d/1hK6qtymSjb32JiMR-5EnxqUbUMeER2xF/view?usp=sharing |
@tschmetzer very slow indeed, but I think is expected if it is a normal sqlite database https://gdal.org/drivers/vector/sqlite.html While the SQLite driver supports reading spatial data from records, there is no support for spatial indexing, so spatial queries will tend to be slow (use Spatialite for that). You may want to convert to GPKG (it gave me a very large datasource but very snappy), or to Spatialite, i.e.
|
@tschmetzer this created a file that in size is very similar to the GPKG (so much bigger than your original one) but perfectly functional. |
@gioman Thank you so much for your hints! OK, there seem to be various distinct topics in my report that I originally all attributed to a pure index problem. One major issue is for sure the distinction between SpatiaLight and SQLite which both use the same file extension (.sqlite). SpatiaLight is indexable but SQLite is not. As we are discussing this with regards to help the QGIS project move forward there might be some things worth discussing for potential improvements:
Regarding the very slow field calculator (seems to hang but will probably finish after hours) when using an aggregate expression with a location filter by geometry the slow behaviour shows off with small shape files as well (evaluation of 5,000 points in 3 polygons took about 25 minutes). So I guess this is just due to a not optimised implementation of the aggregate function that I used on a polygon layer:
If that very slow behaviour shouldn't exist I can create a new issue as it is off-topic from SpatiaLite index. |
@tschmetzer good point, please file a feature request. Note: I checked with
and as a fact that option generates a plain SQLite db ("SQLITE: OGR style SQLite DB found !") rather than a Spatialite enabled ("SQLITE: SpatiaLite v4 DB found !").
I agree. On a plain SQLite db that option has no effect. And in fact if the datasource is removed and re-added the button is enabled again.
file a ticket with a sample dataset. |
So if I get it right the focus of this ticket remains on the misleading and impossible intent to index a SQLite DB |
I would open a new ticket, this is about DB Manager. @tschmetzer |
Author Name: Reinhard Reiterer (Reinhard Reiterer)
Original Redmine Issue: 15082
Affected QGIS version: master
Redmine category:db_manager
Spatial indexes are not listed in 'Indexes' tab and the 'DB Manager' crashes when adding a index (see screencast).
The text was updated successfully, but these errors were encountered: