对小表的查询超时

时间:2011-02-03 22:42:35

标签: sql tsql sql-server-2008 timeout

我正在尝试执行一个查询,该查询从列document(varbinary(max)) is null的表中获取所有ID。

查询总是超时,我在5000行表中运行它。

select ID from Invoice where Document is null

我正在使用SQL Express 2008 R2和Sql Management Studio。这是正确的方法吗?我错过了什么吗?即使我将查询超时前1添加

3 个答案:

答案 0 :(得分:4)

有时表会被锁定。尝试点击界面中选定的表格。

您使用的是什么RDBMS?为SQLserver? SYBASE?或..

当你这样做时,它是否仍然超时:?

SELECT TOP 10 ID
from Invoice where Document is null

答案 1 :(得分:1)

这样做,只读外观

select ID from Invoice (nolock) where Document is null

答案 2 :(得分:1)

If connecting on localhost Then

    If connecting from Management Studio Then

        Try restarting SQL Server services...could be locks.
        Try restarting machine...could be locks.

    ElseIf connecting from remote app code Then

        Check if SQL Server is setup for remote connections.
        Check connection strings.
        Check seccurity privleges.
        Check log file.

    End If

Else
             Check if SQL Server is setup for remote connections
        Check connection strings.
        Check seccurity privledges.

End If