Is there any alternative of GeoArea.STAsText() in sql server? I have the below query:
Select
T.ClassType,
G.CorporationID,
G.ClassName,
GeoArea.STAsText() As GeoText
From
Classtypes t
Inner Join Class g On T.PKClassTypeID = G.FKClassTypeID
Where
T.ClassType In ('Shop','Home') And
G.quarterid=10
This is taking very huge time to compute. But if I eliminate the GeoArea.STAsText()
then my query runs in a fraction of seconds.
Is there a fast alternative to GeoArea.STAsText()
?
The following recommendations will help you in your SQL tuning process.
You'll find 3 sections below:
CREATE INDEX class_idx_quarterid ON Class (quarterid);
CREATE INDEX classtypes_idx_pkclasstypeid_classtype ON Classtypes (PKClassTypeID,ClassType);
SELECT
T.ClassType,
G.CorporationID,
G.ClassName,
GeoArea.STAsText() AS GeoText
FROM
Classtypes t
INNER JOIN
Class g
ON T.PKClassTypeID = G.FKClassTypeID
WHERE
T.ClassType IN (
'Shop', 'Home'
)
AND G.quarterid = 10