Hi Joseph –
There is definitely an issue with spatial index creation time in SQL Azure.
There was a 20 minute difference in time to create the same index on the same data between SQL Azure and SQL Server 2008 R2.
And I used my laptop to create the spatial index on SQL Server 2008 R2 no less.
SELECT
COUNT(*)
FROM ZIPCodes
--Results: 49,146 rows
CREATE
SPATIAL INDEX geog_llmh_64_sidx
ON ZIPcodes(geog)
USING GEOGRAPHY_GRID
WITH (
GRIDS = (LOW, LOW, MEDIUM, HIGH
),
CELLS_PER_OBJECT = 64
);
--Results: [SQL Azure 11.01.1756.35]
20:04 min:sec
--
[SQL Server 2008 R2 10:50:16170.0 (X64)] 00:04 min:sec
DECLARE @point
GEOGRAPHY =
'Point(-122 38)'
SELECT
TOP(1) z.Name
FROM ZipCodes z
WHERE z.Geog.STDistance(@point)
IS NOT
NULL
ORDER
BY z.Geog.STDistance(@point)
--Results: [SQL Azure 11.01.1756.35] Name=94521 in 00:00 min:sec
The good news is that distance queries perform well in SQL Azure when a spatial index is present and recognized.
While we are getting this issue sorted out, I’d recommend that you create a staging database in SQL Server 2008 R2 or SQL Server 2012 CTP3.
Create and test your spatial indexes in the staging database.
Then you can move the table and associated spatial indexes (etc.) to SQL Azure with a tool like the SQL Azure Migration Wizard (http://sqlazuremw.codeplex.com/).
Thanks,
-Ed
Ed Katibah
Spatial Program Manager
SQL Server/SQL Azure
Microsoft Corporation
Ed Katibah
Spatial Ed Blog