I ran several tests in the new SqlGeography spatial library in SQL Server 2016, which, according to Microsoft, should be much faster than previous versions:
SQL Server 2016 - it just works faster: proprietary spatial implementations. Apply SQL Server 2016, and the breadth of methods and spatial actions are faster and better. There are no application or database changes since SQL Server binary updates show significant improvement.
However, tests show that the new library is slower than the old. I tested it in C # with Nugets published by Microsoft, Microsoft.SqlServer.Types . I tested version 11 compared to version 14 (SQL Server 2016).
What should I do to improve the performance of the new spatial library?
Source code for a little test:
var line1 = CreateLine(56, -4, 58, 16); var line2 = CreateLine(58, -4, 56, 16); for (int i = 0; i < 50000; i++) { var intersection = line1.STIntersects(line2); var contains = line1.STBuffer(1000).STContains(line1); } public static SqlGeography CreateLine(double fromLat, double fromLon, double toLat, double toLon) { SqlGeographyBuilder constructed = new SqlGeographyBuilder(); constructed.SetSrid(4326); constructed.BeginGeography(OpenGisGeographyType.LineString); constructed.BeginFigure(fromLat, fromLon); constructed.AddLine(toLat, toLon); constructed.EndFigure(); constructed.EndGeography(); var line = constructed.ConstructedGeography; return line; }
source share