简体   繁体   English

登录超时超时错误的第一个SQL查询

[英]login timeout expired error on first sql query

I'm running SQL Server 2005 and using IIS for ASP scripts. 我正在运行SQL Server 2005,并将IIS用于ASP脚本。

I have a problem with sql that is when I run a sql query (exp : http://[host name] with localhost as [host name]) at first time (like when I start my windows) or when the session times out due to being idle for too long, this error happens : 我在使用sql时遇到问题,即在第一次(例如,启动Windows时)运行SQL查询(exp:http:// [主机名], localhost为[主机名])时由于闲置时间过长,发生此错误:

Login Timeout Expired 登录超时已过期

but after that when I refresh the page, everything will be OK and it works like it should be. 但是在那之后,当我刷新页面时,一切都会好起来的,它的工作应该像应该的那样。

It looks like it takes a long time to run the sproc the "first" time, from then on it only takes less than a sec to execute the sproc. 

SQL Server will generate a execution plan for the stored procedure when it runs the first time, so it will cause a long duration. SQL Server首次运行时将为该存储过程生成一个执行计划,因此将导致较长的持续时间。 Then next times SQL can reuse the exection plan so the duration becomes shorter. 然后,下次SQL可以重用执行计划,因此持续时间会缩短。 However a duration of 46secs is abnormal, you can try to create a clustered index on the table, in order to speed up query. 但是46秒的持续时间是异常的,您可以尝试在表上创建聚簇索引,以加快查询速度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM