-
Notifications
You must be signed in to change notification settings - Fork 22
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
ENH: support writing geopackage files without index #62
Comments
It's already supported in general to pass through GDAL options, so according to https://gdal.org/drivers/vector/gpkg.html we can do:
and that indeed seems to give a significant difference in this case. So it might be mostly a matter of better document this general ability, and give a few specific useful examples like this one. |
What I find unexpected that it seems that those files without index are also quite a bit faster to read:
|
Ah, great to be able to just pass on GDAL options! I wasn't able to reproduce it immediately though: the index was still created. So I had a quick look at the code and it seems like the kwargs parameter is missing in the OGR write() call. I created a pull request with a proposal to fix (#67). After the fix, the SPATIAL_INDEX="NO" indeed does the trick! On my windows system, writing the agriprc_2018.gpkg file takes 15 s without index, 40 s with index. Only double the time you get on linux :-) (~20s with index). |
Ah, good catch, so my timings were just nonsense :) (I think the difference in writing was because of the one including the time to "overwrite" and thus delete an existing file. The reading time just seems quite unstable) Doing again with your fix, there is now even a bigger difference (and now the resulting filesize is also actually different):
And for reading there isn't a significant difference (as can be expected for reading the full file without spatial query) |
Writing a geopackage without index is 20% faster based on a test I did using gdal. So if you don't need an index in the output file, this is an interesting option.
Also, based on my experience, if you need to eg. merge several geopackages by appending them one by one to a new file, it is also faster to first add them all one by one without index, and then add the index in one go. Because pyogrio doesn't support appending yet this isn't a usable case yet, but... might become one in the future.
The text was updated successfully, but these errors were encountered: