OSGeo / gdal

GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
https://gdal.org
Other
4.91k stars 2.55k forks source link

MSSQLSpatial: fires queries twice #1361

Open wilhelmberg opened 5 years ago

wilhelmberg commented 5 years ago

Expected behavior and actual behavior.

Expected: Each query should only fire once.

Actual: I used UMN mapserver with SQL Server layers included via CONNECTIONTYPE OGR to create MVTs (Mapbox Vector Tiles) but was hitting a bottle neck with the number of tiles that were generated per second.

Looking at the SQL Server Profiler I saw that all queries were fired twice and suspected some error in mapserver's mapscript (https://github.com/mapserver/mapserver/issues/5759).

But this also happens executing SQL queries via ogrinfo.

Steps to reproduce the problem.

I've manually added an entry for view vw_edges to the table geometry_columns.

ogrinfo -sql 
     "SELECT ogr_fid, geom FROM vw_edges WHERE ogr_fid=1" 
     "MSSQL:server=MyServer;database=MyDb;uid=MyUid;pwd=MyPwd"

image

Operating system

Windows 10 SQL Server 2016 SP1

GDAL version and provenance

GDAL 2.4.0 from https://www.gisinternals.com/query.html?content=filelist&file=release-1911-x64-gdal-2-4-0-mapserver-7-2-2.zip

rouault commented 5 years ago

CC @szekerest