我正在做一个从 oracle 数据库读取数据的项目。我使用了 Silverlight RIA 和自动生成的 DomainService,因为我不太关心结构,因为我只担心显示数据。
我的问题是,当我使用 XAML 中的域数据源并使用 fiddler 调试 WCF 服务及其调用时,用户帐户表中的第一组数据包含 200 万行,并且 DomainService 超时。
现在我尝试将服务超时增加到 20 分钟,但仍然无济于事,我收到错误:
查询“GETUA_USERACCOUNTS”的加载操作失败。 http 请求已超过分配的超时
另外,在我使用的总共 9 个表中,有 3 个表约有 200 万行,解决此问题的最佳方法是什么?
I'm doing a project that reads from an oracle database. I have used Silverlight RIA, and autogenerated DomainService since I'm not too concerned about structuring as I only worry about displaying the data.
My question is, that when I use the domaindatasource from the XAML, and use fiddler for debugging the WCF service and its calls, the first set of data from the table of useraccounts contains 2 million rows, and the DomainService times out.
Now I have tried increasing the timeout of the service to 20 mins, but still no avail, I get the error:
Load operation failed for query "GETUA_USERACCOUNTS". The http request to has exceeded the alloted timeout
Also out of the total 9 tables that I use, 3 tables have around 2 million rows, what would be the best method to approach this problem?
发布评论
评论(4)
使用 ToTraceString 方法...
http:// msdn.microsoft.com/en-us/library/system.data.objects.objectquery.totracestring.aspx
...或 Oracle 分析工具来确定正在使用的 SQL 语句并确认它是否需要很久执行。
使用查询优化技术(例如添加索引)来加快速度。
或者,编写一个存储过程,以更有效的方式返回所需的结果。
Use the ToTraceString method...
http://msdn.microsoft.com/en-us/library/system.data.objects.objectquery.totracestring.aspx
...or an Oracle profiling tool to determine the SQL statement that is being used and confirm that it takes a long time to execute.
Use query optimization techniques such as adding indexes to speed it up.
Alternatively, write a stored procedure that returns the required result in a more efficient manner.
之前,在服务器上进行数据过滤/处理
要继续 TomTom 离开的地方,Red 询问,在返回结果(伪代码)和消费者
:然后,你的消费者将只收到一个数据行。基本形式如下:
考虑:服务器总是比您的客户端计算机强大得多。让它完成过滤/排序/预处理结果的所有工作,并让它交出最少的数据。您会发现您的 RIA 实施变得更加敏捷。
To continue where TomTom left off, and Red asked, do your data filtering / processing on the server, before returning the results (Psuedocode)
and your comsumer:
You consumer will then only recieve the one data row. The basic form is like so:
Consider: Invariably, the sever is going to be a lot beefier than your client machine. Let it do all the work of filtering / sorting / preprocessing results, and have it hand over minimal data. You will find your RIA implementations become much more snappy.
您应该使用 DataPager,请参阅此处: http://www.silverlightshow.net/items/Creating-applications-with-.NET-RIA-Services-Part-4-Adding-a-DomainDataSource.aspx
You should use a DataPager, see here: http://www.silverlightshow.net/items/Creating-applications-with-.NET-RIA-Services-Part-4-Adding-a-DomainDataSource.aspx
我遇到了类似的问题,为了处理这个问题,我在数据库上创建了存储过程来完成工作,并且只返回我需要的信息。关于向 RIA 添加存储过程的信息并不多,但这里是我所知道的工作原理的一个镜头。
构建您的项目并根据需要从代码隐藏中调用方法
I had similar issue and to handle this i created stored procedures on my database to do the work and only spit back the information i needed. There is not a lot of info on adding stored procedures to RIA but here is a shot on what i know works.
in your domain service add a public method that returns the result list.
build your project and call the method as needed from code behind