1

If one (select) query is run against database and it takes 10mins to finish, what is with performance of the server while this query is running? To be more precise, is it possible to run other queries at the same time and how does this "long" one affect speed performance?

Thanks, Ilija

ilija veselica
  • 9,414
  • 39
  • 93
  • 147

1 Answers1

2

Database engines are designed for multiple concurrent users. Data and execution plans are cached and re-used, it has it's own scheduler etc

There are some exceptions:

  • a badly structured query can run 100% CPU on all cores
  • a long running UPDATE or INSERT or transaction can block other users
  • not enough memory means paging and thrashing of data through cache
  • ... and lots more edge cases

However, day to day it shouldn't matter and you won't know the 10 minute query is running.

gbn
  • 422,506
  • 82
  • 585
  • 676
  • what does it mean badly structured query? I'm using only SELECT query which needs to sum lot of data and that's the reason why it takes long time to run. Thanks for the answer! – ilija veselica Jan 31 '11 at 11:33
  • 2
    @ile: Just one that is badly written, for example with too many udfs. A straightforward aggregate should be OK, just long running. I'm sure your code is excellent! :-) – gbn Jan 31 '11 at 11:48
  • Then it looks like my queries are OK, there are only straightforward aggregates used. Thanks :) – ilija veselica Jan 31 '11 at 11:56