[gdal-dev] OGR SQL performance issue with VRT as a source?
Andrey VI
andrey_vi at list.ru
Mon Oct 20 01:47:30 PDT 2025
Hi all.
I have found a significant performance drop when using OGR SQL with VRT as a source. Test results with sample data ( link , 6,8 MB).
VRT as a source:
$ time ogr2ogr -dialect sqlite -sql "SELECT geometry, CAST(ABS(MAX) AS INT) AS depth FROM merged ORDER BY MAX DESC" sample_vrt-sqlite.geojsons sample.vrt
real 0m3,960s
user 0m0,037s
sys 0m0,022s
$ time ogr2ogr -sql "SELECT CAST(MAX * -1 AS INTEGER) AS depth FROM merged ORDER BY MAX DESC" sample_vrt-ogr.geojsons sample.vrt
real 3m4,108s
user 0m0,057s
sys 0m0,016s
Shapefile as a source:
$ time ogr2ogr -dialect sqlite -sql "SELECT geometry, CAST(ABS(MAX) AS INT) AS depth FROM sample ORDER BY MAX DESC" sample_shp-sqlite.geojsons sample.shp
real 0m3,627s
user 0m0,036s
sys 0m0,025s
$ time ogr2ogr -sql "SELECT CAST(MAX * -1 AS INTEGER) AS depth FROM sample ORDER BY MAX DESC" sample_shp-ogr.geojsons sample.shp
real 0m3,731s
user 0m0,052s
sys 0m0,025s
Since my VRTs consist of tens and hundreds of Shapefiles, OGR SQL becomes unusable for the specific task given as an example above.
So I wonder what could be the reason for such a significant drop in performance in this particular case? Or maybe I’m doing something wrong?
--
Andrey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20251020/4e7c1e8b/attachment.htm>
More information about the gdal-dev
mailing list