I have an interesting problem. I have a select statement generated by GeoServer on a de-normalized table. The structure of the query is this
select "the_geom".STAsBinary() as "the_geom"
from TABLE
where [a bunch of ands and ors condition]
AND
"the_geom".Filter(geometry::STGeomFromText('') = 1;
This question takes around 6 minutes. If I skip the spatial condition, the question takes around 1 second. The database is around 40GB, SQL Server 2014, 26GB of RAM. I have a spatial index and other indexes for the non-spatial parts. The spatial index has grid-size around 600.
So my question is if there is any way I can make this question faster? Any tweeks I can do in SQL Server?