sql server中几何表的性能问题

zd287kbt  于 2021-07-24  发布在  Java
关注(0)|答案(0)|浏览(269)

我使用的是sql server 11。下表存储了新南威尔士州所有lga的边界

CREATE TABLE [dbo].[nsw_lga_polygon_shp](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [geom] [geometry] NULL,
    [lg_ply_pid] [nvarchar](15) NULL,
    [dt_create] [date] NULL,
    [dt_retire] [date] NULL,
    [lga_pid] [nvarchar](15) NULL,
    [nsw_lga_sh] [date] NULL,
    [nsw_lga__1] [date] NULL,
    [nsw_lga__2] [nvarchar](100) NULL,
    [nsw_lga__3] [nvarchar](100) NULL,
    [nsw_lga__4] [date] NULL,
    [nsw_lga__5] [nvarchar](15) NULL,
 CONSTRAINT [PK_nsw_lga_polygon_shp] PRIMARY KEY CLUSTERED 
(
    [id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
GO
SET IDENTITY_INSERT [dbo].[nsw_lga_polygon_shp] ON;

这个表只有198行
当我尝试将结果Map到一个有36531行的表时,我注意到它有非常严重的性能问题,它要求5分钟生成500行。

select 
    * ,
    (select top 1

    nsw_lga__2
from 
    [nsw_lga_polygon_shp]
where

    Geom.Filter(geometry::STGeomFromText('point(' +
        convert(varchar(100),longitude_GIS )+ 
        ' ' + 
        cast(latitude_GIS as varchar(100))+ ')',4283)) = 1 
    ) LGA
from 
    Report_A

有什么我能跑得更快的吗?我可以索引几何列吗?
提前谢谢!

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题