In my SQL-Server 2008 R2 i have a SQL query:
SELECT
IceCrossing.WaterwayName as WaterWayName,
IceCrossing.Segment_ID as Segment_ID,
the_geom = Track.Track
FROM dbo.IceCrossing
LEFT JOIN Track ON IceCrossing.Segment_ID=Track.Segment_ID
There i want to select all rows from IceCrossing and if in Track exists row with same Segment_ID show it in result. And there is problem with JOIN. Becouse its query works 4-5 seconds for return me my 260 rows. I was tried to change it:
SELECT
IceCrossing.WaterwayName as WaterWayName,
IceCrossing.Segment_ID as Segment_ID,
the_geom = Track.Track
FROM dbo.Track
RIGHT JOIN IceCrossing ON Track.Segment_ID=IceCrossing.Segment_ID
But same time.
Its possible to make it faster without make a any things with data base and table structures?
UPDATE
More info.
Track - 209 rows.
IceCrossing - 259 rows.
Segment_ID type - [uniqueidentifier]
How to know about indexes on this?
UPDATE2
How i understand my problem in the the_geom
field. Becouse query:
SELECT
IceCrossing.WaterwayName as WaterWayName,
IceCrossing.Segment_ID as Segment_ID,
FROM dbo.IceCrossing
LEFT JOIN Track ON IceCrossing.Segment_ID=Track.Segment_ID
Works within a second.
the_geom type - geometry its like a very long string.
What can i do in this case?