简体   繁体   English

在组中使用表达式时,Visual Studio 2008中的SSRS 2008预览缓慢

[英]SSRS 2008 slow preview in Visual Studio 2008 when using expressions in groups

When creating a matrix report in Visual Studio 2008 that uses an expression like the one below, the preview takes much longer than it should do. 在Visual Studio 2008中使用以下表达式创建矩阵报表时,预览所花费的时间比应该花的时间长得多。

=Fields(Parameters!ColumnGroupParam.Value).Value = Fields(Parameters!ColumnGroupParam.Value).Value

If the same report is either deployed to the report server and viewed within the report manager or the report is designed using Report Builder rather than Visual Studio, there are no issues and the report generates quickly. 如果将同一报告部署到报告服务器并在报告管理器中查看,或者使用Report Builder而不是Visual Studio设计该报告,则不会出现问题,并且报告会快速生成。

When looking at the results from SQL Server Profiler the query is taking much longer to return the result set when it is queried from Visual Studio. 从SQL Server Profiler查看结果时,从Visual Studio查询结果集时返回查询要花费更长的时间。

Report Manager: Duration = 1885 报表管理员:工期= 1885

Visual Studio: Duration = 327946 (173x longer!) Visual Studio:持续时间= 327946(长173x!)

In general, query execution appears to be slower when done from Visual Studio even without the expressions used for groups. 通常,即使没有用于组的表达式,从Visual Studio中执行查询时,查询执行的速度也会变慢。 I had the same behaviour when trying this out in SQL Server 2008 R2 and SQL Server 2012. 在SQL Server 2008 R2和SQL Server 2012中进行尝试时,我有相同的行为。

Has anyone else come across this behaviour before and found a suitable fix? 有没有其他人以前遇到过这种行为并找到了合适的解决方案?

Steps to reproduce: 重现步骤:

Using AdventureWorksDW2008 database create a matrix report within Visual Studio 2008 using the following query as the dataset: 使用AdventureWorksDW2008数据库,使用以下查询作为数据集,在Visual Studio 2008中创建一个矩阵报表:

SELECT
PC.EnglishProductCategoryName AS Category
,PSC.EnglishProductSubcategoryName AS Subcategory
,P.EnglishProductName AS ProductName
,G.EnglishCountryRegionName AS Country
,G.StateProvinceName AS State
,FIS.SalesAmount
FROM        dbo.FactInternetSales FIS
INNER JOIN dbo.DimProduct P
ON FIS.ProductKey = P.ProductKey
INNER JOIN dbo.DimProductSubcategory PSC
ON P.ProductSubcategoryKey = PSC.ProductSubcategoryKey
INNER JOIN dbo.DimProductCategory PC
ON PSC.ProductCategoryKey = PC.ProductCategoryKey
INNER JOIN dbo.DimCustomer C
ON FIS.CustomerKey = C.CustomerKey
INNER JOIN dbo.DimGeography G
ON C.GeographyKey = G.GeographyKey

Create 2 parameters RowGroupParam and ColumnGroupParam both with available values Category, Subcategory, ProductName. 创建2个参数RowGroupParam和ColumnGroupParam,它们均具有可用值Category,Subcategory,ProductName。

Create a row group using the expression =Fields(Parameters!RowGroupParam.Value).Value and column group using the expression =Fields(Parameters!ColumnGroupParam.Value).Value. 使用表达式= Fields(Parameters!RowGroupParam.Value).Value创建行组,并使用表达式= Fields(Parameters!ColumnGroupParam.Value).Value创建列组。 Use the same expressions for the textbox values for the row and column group. 对行和列组的文本框值使用相同的表达式。

Use SalesAmount for the detail textbox. 将SalesAmount用于详细信息文本框。

Run the report selecting Category for the row group parameter and Subcategory for the column group category. 运行报告,为行组参数选择“类别”,为列组类别选择“子类别”。 Wait 30 seconds for the report to generate. 等待30秒以生成报告。

Deploy the same report to the report server and run the report with the same parameters. 将相同的报表部署到报表服务器,并使用相同的参数运行报表。 The report will generate in a few seconds. 该报告将在几秒钟内生成。

I can't give you a 100% answer, just my expirience. 我不能给你100%的答复,只是我的经验。 As the report service builds its own internal record set it fetches all the data and create a new virtual recordset (table). 当报表服务建立自己的内部记录集时,它将获取所有数据并创建一个新的虚拟记录集(表)。 This works, as you mentioned, slower then executing from a sql query directly. 如您所述,这比直接从sql查询执行要慢。 So what I do to prevent this: Always build queries and store them inside ms sql to perform all the work there. 因此,我为防止这种情况所做的操作:始终构建查询并将其存储在ms sql中,以执行那里的所有工作。 In the report itself I access the results of the query only. 在报告本身中,我仅访问查询结果。

Eg SELECT * FROM qry_verycomplicatedquery which is stored in ms sql as query. 例如SELECT * FROM qry_verycomplicatedquery ,它作为查询存储在ms sql中。

Maybe someone else knows a better way, but this way is imho easier to handle later anyway to administratote lots of reports using the same data source. 也许其他人知道更好的方法,但是无论如何以后使用同一数据源来管理大量报告,无论如何,这种方法都不容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Visual Studio SSRS 2008中使用SQL使用多个条件语句 - How to use multiple conditional statements using SQL in Visual Studio SSRS 2008 如何在Visual Studio SSRS 2008中使用SQL将平均值函数与多个条件语句一起使用 - How to use the average function with multiple conditional statements using SQL in Visual Studio SSRS 2008 Visual Studio for SSRS 2008 - 如何在解决方案资源管理器中将报表组织到子文件夹中? - Visual Studio for SSRS 2008 - How to organize reports into subfolders in Solution Explorer? Visual Studio 2008年 - Visual Studio 2008 使用 null 的 Visual Studio 2008 案例表达式 - Visual Studio 2008 Case Expression using null Visual Studio 2008 + SQL 2008最佳做法 - Visual Studio 2008 + Sql 2008 best practices 使用Visual Studio 2008部署SQL项目时出错 - Error when deploying a SQL project with Visual Studio 2008 SSRS Visual Studio 2008-如何将名称与管道分隔的名称列表进行比较? - SSRS Visual Studio 2008 - How to compare name to pipe delimited list of names? 使用Visual Studio 2013连接到SQL Server 2008 - Connect to SQL Server 2008 using Visual Studio 2013 无法使用C#visual Studio 2008将数据插入表中 - Cannot insert the data into the table using C# visual studio 2008
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM