我运行脚本,从表中选择:
SELECT *
FROM [Portfolios]
where Delisted = 0
and BrokerAccountId is not null
and ImportType = 2
GO
表的脚本:
CREATE TABLE [dbo].[Portfolios](
[PortfolioId] [int] IDENTITY(1,1) NOT NULL,
[UserId] [int] NOT NULL,
[Guid] [uniqueidentifier] ROWGUIDCOL NOT NULL,
[Name] [nvarchar](255) NOT NULL,
[Notes] [nvarchar](max) NULL,
[IsDefault] [bit] NOT NULL,
[Cash] [money] NOT NULL,
[CurrentCash] [money] NULL,
[Type] [int] NULL,
[Delisted] [bit] NOT NULL,
[CurrencyId] [int] NOT NULL,
[TrackCashBalanceType] [int] NULL,
[IsDividendReinvestment] [bit] NOT NULL,
[ItemId] [int] NULL,
[FinancialInstitutionId] [int] NULL,
[Configured] [bit] NULL,
[BrokerAccountId] [int] NULL,
[ImportType] [int] NULL,
[PortfolioTotalValue] [money] NULL,
[IsRequireNewCredentials] [bit] NOT NULL,
CONSTRAINT [Portfolios_PK] PRIMARY KEY CLUSTERED
(
[PortfolioId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [Portfolios_uq] UNIQUE NONCLUSTERED
(
[Guid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
通常,此脚本执行大约 10 秒。但是现在它没有完成,但是当我取消在 SQL Server 中执行查询时,所有需要的数据都被读取。
任何想法为什么查询没有完成?