Here is my request:
SELECT * FROM [GeoName]
WHERE ((-26.3665122100029-Lat)*(-26.3665122100029-Lat))+((27.5978928658078-Long)*(27.5978928658078-Long)) < 0.005
ORDER BY ((-26.3665122100029-Lat)*(-26.3665122100029-Lat))+((27.5978928658078-Long)*(27.5978928658078-Long))
LIMIT 20
This returns the 20 closest points.
Running this in native sqlite returns the result within 78 ms, but from the .NET environment. sqlite takes almost 1400 ms.
Any suggestions?
I have this query in my ORM structure and using parameterized values. Also tried it as your own text query.
The code executing the request (inside my ORM layers):
private static IDataReader CallSqlReader(string SqlStatement, Dictionary<string, object> parameters)
{
ConnectionCheck();
try
{
var cmd = conn.CreateCommand();
cmd.CommandText = SqlStatement;
cmd.CommandType = CommandType.Text;
foreach (var item in parameters)
{
cmd.Parameters.AddWithValue(item.Key, item.Value);
}
return cmd.ExecuteReader();
}
catch { }
return null;
}
source
share