Currently I am using SQL Server and having issues, i have a table Adress with 12M of addresses; when i look for one addresses; its take 3 or 4 minutes to find it. i have to look for more than 40000 adressess averyday in my table. so Sql server dont help me to resolve this problem. i think about using an other SGBD maybe MongoDB, but i dont have any idea if it will work or not. my goal is to find every query in less than 2 sec.
My query :
SELECT TOP 1 adresse
FROM (SELECT
geography::Point(p.latitude, p.longitude,4326).STDistance(geography::Point(Cast(Replace('28,5259799957275', ',', '.') AS FLOAT)
, Cast(Replace('28,5259799957275', ',', '.') AS FLOAT), 4326)) AS rn,
p.adresse
FROM [adressespositions] p) ph
WHERE ph.rn < 10
My table :
CREATE TABLE [dbo].[adressespositions](
[idgeocodage] [int] IDENTITY(1,1) NOT NULL,
[latitude] [float] NULL,
[longitude] [float] NULL,
[adresse] [nvarchar](100) NULL,
[dateajout] [datetime] NULL,
[source] [nvarchar](100) NULL,
[idsource] [int] NULL
) ON [PRIMARY]
the RAM of my server : 128 GB.
how can i make this query very fast ? or i have to use an other SGBD ?
Pointcolumn in the table with a spatial index and the query must be written in a specific way. Without a spatial index all spatial databases will be slow