WITHtAS(SELECT*,ROW_NUMBER()over(orderbyCommentDateDesc)ASssfrom(SELECTid,userid,date,CommentDate,mediaurl,mediatype,content,locationdec,contenttype,messagetype,location.Latlatitude,location.LonglongitudeFROMMessageWHERElocation.STIntersects(geography::STPointFromText('POINT('+@P1+''+@P2+')',4326).STBuffer(@P3))=1And(contenttypein(1,2,8,9,7,6))UNIONALLSELECTid,userid,date,CommentDate,mediaurl,mediatype,content,locationdec,contenttype,messagetype,location.Latlatitude,location.LonglongitudeFROMMessageWHEREContenttype=4)A)SELECT*FROMtWHEREssBETWEEN21AND40当记录大于70万条之后很慢,其中Contenttype=4和geography查询是必须,contenttype1,2,8,9,7,6是不确定的查询参数。
眼眸繁星
相关分类