|
Posted by Erland Sommarskog on 04/03/07 22:04
DzU (claudio@scartozzetto.it) writes:
> I've a DB with a table with lots of records. I run a SELECT from
> query analyzer, and I've results in 10 seconds. Perfect.
>
> When I run the query two times in the same table, seems like
> it been queued. Result in 20 seconds.
>
> With another query, I've result in 40 seconds. If I run this query 2
> times, I've results in 80 seconds.
>
> How can it be? Does Sql Server queue the query?
I'm really sure with what you mean that you run the query twice. If you
do:
SELECT ... FROM tbl WHERE ...
SELECT ... FROM tbl WHERE ...
it's not entirely surprising that this takes twice the timeas ii would be
to run the query a single time. (Alhough often, it's faster the second
time, since the data is in cache the second time.)
Or do you mean that you run the queries in parallel from two different
sessions?
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|