开发者

What performance gains can I expect from database paging?

开发者 https://www.devze.com 2023-01-03 13:45 出处:网络
Say I have a table X with 100 records in it and that running a select * from X takes 100 seconds. How long should I expect the query select top 10 * from X to ta开发者_运维百科ke?

Say I have a table X with 100 records in it and that running a select * from X takes 100 seconds.

How long should I expect the query select top 10 * from X to ta开发者_运维百科ke?

I'd expect that the relationship is more or less linear so 10 seconds. Is this correct, or is the relationship non-linear in some way?


Your performance cost is in two different areas:

  • How long it takes to perform the query
  • How long it takes to return the results

Often, a query will be fast, but returning results will be slow, since it's I/O-bound. If this is the case, then you will see an approximately linear speedup by returning fewer results.

However, if the query itself is complicated, things are different. If it's not just select * from X, but select * from X where [complicated-expression], then results may vary widely between database implementations. In that case, your performance might be dominated by query complexity, in which case you won't see as much benefit by merely returning fewer results.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号