由于asp.net中的大量数据获取查询使速度变慢 [英] due to huge data fetching query in asp.net making slow

查看:134
本文介绍了由于asp.net中的大量数据获取查询使速度变慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

由于在asp.net程序中读取SQL Server的大量数据导致查询变慢.

请详细帮助我,我应该在sql server中使用什么.


谢谢.

Hello

Due to huge data fetching query of sql server in asp.net program making slow.

Please help me in details what should i use in sql server.


Thanks.

推荐答案

没有更好的信息,不可能精确,但有一些一般性建议:

如果是数据获取使速度变慢,那么有一个简单的解决方案:获取较少的数据.

如果要获取所有字段,请
Without much better information, it is not possible to be precise, but there are general recommendations:

If it is the data fetching that is slowing things down, then there is a simple solution: fetch less data.

If you are fetching all fields
SELECT * FROM ...

然后不要-仅选择该行所需的字段.

Then don''t - select only the fields you need for the row.

SELECT Username, email FROM ...

例如,数据库包含图像,这样可以节省大量时间.

如果您一次要获取大量记录,请不要:过滤记录,以便仅检索所需的记录-向用户显示大量记录既缓慢又浪费时间和时间-如何做您希望他们找到感兴趣的数据(如果它是10,000中的一行)?

最后,如果您正在处理数据以从中提取某些特定信息,则可能值得将处理移至存储过程中,以便信息ios在SQL Server上压缩而不是传输然后压缩.并且示例将传输所有行,以便您可以添加总数,而不是使用SQL SUM函数并仅返回单个最终值./

If your database contains images for example, this can save a considerable amount of time.

If you are fetching a lot of records at one time, then don''t: filter your records so you only retrieve those you need - presenting the user with lots of records is both slow and a waste of your time and theirs - how do you expect them to find the data they are interested in, if it is a single row out of 10,000?

Finally, if you are processing the data to extract some specific info from it, it may be worth moving the processing into a Stored Procedure so that the information ios condensed at the SQL Server instead of transferred and then condensed. And example would be transferring all teh rows so that you can add the total, rather than using the SQL SUM function and returning just the single final value./


这篇关于由于asp.net中的大量数据获取查询使速度变慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆