我有 Sql Server 数据库,我的表有 1500000 行......因为我的以下过程的大量数据执行时间非常高
桌子 - - -
CREATE TABLE [dbo].[MyTable](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[Link] [text] NULL,
[Title] [text] NULL,
[Duration] [text] NULL,
[Image] [text] NULL,
[Embbed] [text] NULL,
[Keywords] [text] NULL,
[Category] [text] NULL,
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]
GO
程序 - - -
ALTER PROCEDURE [dbo].[Search]
@SearchQuery varchar(1000),
@Id bigint
As
BEGIN
Select top 100 * from MyTable
where Id > @Id and Title like '%'+@SearchQuery+'%'
谁能帮助我如何最小化 1500000 行表上的 sql 查询的执行时间?