We have a need to limit the rows axis to specific members:
xmlaDataSource.Rows = DataSourceBase.GenerateInitialItems([Date].[Calendar]{[Date].[Calendar].[Date].&[20080702]}");
Unfortunately, this causes a change in behavior within XmlaDataSource.UpdateHierarchiesCollection whereby the entire dimension hierarchy is retrieved instead of just a single level. Looking at the code it seems like the design approach in this case is to fetch the hierarchy and then apply this "pre-filter" after the dimension results are returned.
The associated performance impact is severe -- in the dimension we are working with there is still no response after 10 minutes, whereas without the member value it is a few seconds.
It would be wonderful if Infragistics can address this issue! It's a severe limitation for us and I expect others.
If that is not feasible in the near-term, I still need to resolve it for my own purpose. My approach is to add an event handler for InitXmlaMethod and modify the MDSCHEMA_MEMBERS RequestType to add a MEMBER_UNIQUE_NAME restriction for the member value:
void xmlaDataSource_InitXmlaMethod(object sender, InitXmlaMethodEventArgs e) { var discoverMethod = e.SoapMethod as XmlaSoapMethodDiscover; if (discoverMethod != null) { if (discoverMethod.RequestType == "MDSCHEMA_MEMBERS") { discoverMethod.Restrictions.Add("MEMBER_UNIQUE_NAME", "[Date].[Calendar].[Date].&[20080702]"); } } }
Looking at the request and response in Fiddler, I see that this works well.
However, this change causes the following Execute request to generate a malformed statement.
Below is what the statement looks like without adding the restriction. Bolded is what is omitted from the statement when the restriction is added.
SELECT
NON EMPTY
{{[Date].[Calendar].[All Periods]},
{[Date].[Calendar].[All Periods].Children},
{[Date].[Calendar].[Calendar Year].&[2008].Children},
{[Date].[Calendar].[Calendar Semester].&[2008]&[2].Children},
{[Date].[Calendar].[Calendar Quarter].&[2008]&[3].Children},
{[Date].[Calendar].[Month].&[2008]&[7].Children}}
DIMENSION PROPERTIES
CHILDREN_CARDINALITY
,PARENT_UNIQUE_NAME
ON COLUMNS
FROM
(
[Date].[Calendar].[Date].&[20080701] ON COLUMNS
FROM [Adventure Works]
)
WHERE ([Measures].[Internet Sales Amount])
I appreciate your assistance with working through this difficulty.
Thanks,
Gary
Hello Gary,
I have tested pre-filtering against Adventure Works sample database and the data appears almost immediately, but of course it depends on amount of the data and connection to the server. If you give us more information we probably can look for some oprtimization there.
The restriction you have added makes that you have loaded only the member you have specified but that breaks the hierarchy structure we depend on. What you need is to add also TREE_OP restriction with value of 40 (it’s 0x20 and 0x08) Here are the possible flag values of TREE_OP
· MDTREEOP_ANCESTORS (0x20) returns all of the ancestors.
· MDTREEOP_CHILDREN (0x01) returns only the immediate children.
· MDTREEOP_SIBLINGS (0x02) returns members on the same level.
· MDTREEOP_PARENT (0x04) returns only the immediate parent.
· MDTREEOP_SELF (0x08) returns itself in the list of returned rows.
· MDTREEOP_DESCENDANTS (0x10) returns all of the descendants.
You have probably seen these values in the documentation of MDSCHEMA_MEMBERS Rowset
Your event handler will be:
void xmlaDataSource_InitXmlaMethod(object sender, InitXmlaMethodEventArgs e) { var discoverMethod = e.SoapMethod as XmlaSoapMethodDiscover; if (discoverMethod != null) { if (discoverMethod.RequestType == "MDSCHEMA_MEMBERS") { discoverMethod.Restrictions.Add("MEMBER_UNIQUE_NAME", "[Date].[Calendar].[Date].&[20080702]");
discoverMethod.Restrictions.Add("TREE_OP", 40); } } }
Also you have to keep this line
so we can process the response properly in the way we process pre-filtered hierarchies. Please note that this hierarchy will be trimmed to this member and its descendants and we don't have mechanism to extend that hierarchy further, so if you remove it from rows and add it again later (even using drag-drop) you will have the same pre-filtered structure.
Best regards.
Plamen.
Hello Plamen,
You wrote "I have tested pre-filtering against Adventure Works sample database and the data appears almost immediately, but of course it depends on amount of the data and connection to the server. If you give us more information we probably can look for some optimization there."
I am very interested in your help with optimizing this. I have included some more information that I hope you will find useful:
Scenario 1: Adventure Works Date Dimension Level loaded
Scenario 2: Adventure Works Date Dimension Hierarchy loaded
Scenario 3: My Date Dimension Hierarchy loaded
If you are able to optimize the pre-filtering logic so that the entire hierarchy isn't loaded, then the 20MB download will be reduced to about 90K.
I also want to mention that the approach of applying a MEMBER_UNIQUE_NAME restriction turns out to not be a viable solution because this restriction is limited to accepting on one member value only. In my real world case, the parameter string passed to GenerateInitialItems may contain more than one value, for example:
xmlaDataSource.Rows = DataSourceBase.GenerateInitialItems([Date].[Calendar]{[Date].[Calendar].[Date].&[20080701],[Date].[Calendar].[Date].&[20080702]}");
Here is where I sought clarification on this aspect of the XMLA 1.1 spec:
http://social.msdn.microsoft.com/Forums/en-US/sqlanalysisservices/thread/3380ad3c-60a8-4166-bbc9-0e4f4a4751e4
Thank you,
Wouldn’t it be better to use [Date].[Date] hierarchy then? If you still want to see the rows for [Date].[Calendar] you can place the pre-filtered [Date].[Date] in Filters collection and leave [Date].[Calendar] in the Rows without setting any filters for it. The loading and pre-filtering of [Date].[Date] will be much faster than doing that using [Date].[Calendar] because it has just one level.
Filters="[Date].[Date]{[Date].[Date].&[20020409], [Date].[Date].&[20040205]}"
Rows="[Date].[Calendar]"
When testing this on the Adventure Works cube, the response size of fetching the [Date].[Date] one level hierarchy is almost 1MB.
Our Date dimension spans 100 years instead of 5 years, so our response size is about 20MB, which of course is very slow.
It seems that the key requirement is for there to be a way for the filter to be applied in the query rather than against the results.
Currently, Infragistics does not pass the filter requirements into the query, but elects to process it post-result instead. To support this the dimensions used by the query are loaded. This is what creates the performance issue. If you were to include the filters within the query, it looks to me that the response not only includes the results in the CellData element, but also include hierarchy information in the OlapInfo and Axis info that could be used to provide the rendering context of the results.
I am willing to do work to resolve this. But if you can provide some direction on how to approach the issue that would be helpful. Currently, we have an application that cannot be deployed due to this issue.
Could you provide us with more information about what filter requirements you mean saying:
"Currently, Infragistics does not pass the filter requirements into the query"
Thanks.
I am referring to the XMLA Execute statement:
The goal is to be able to use the XmlaDataSource to query data without the side effect of loading complete dimensions.
When the Rows or Columns property is initialized with filters (individual member values), these filters are not included within the Execute statement, but are instead applied as "pre-filters" on the results that are returned.
To support this approach, the entire hierarchy or the entire level of applicable dimensions are loaded, which causes a performance issue on dimension levels with a large number of members.
When we apply filters we are reducing the number of applicable members from a large number to a small number. We would like the XmlaDataSource to not have the overhead of querying the large number of members when only a small number are needed.
Hopefully this makes sense, but please let me know if you need more information.
Regards,
Performance optimization and reducing of the response size has been determined to be a new feature request. I have sent your feature request directly to our product management team. Our product team chooses new feature requests for development based on popular feedback from our customer base. Infragistics continues to monitor application development for all of our products, so as trends appear in requested features, we can plan accordingly. Your reference number for this is FR14172.
Please let me know if you need any additional information on this.
I am not sure why your Execute statement looks different than mine. However, I realize that my explanation of the root issue wasn't very clear in the last post. The problem is not with the Execute per se, it is with the preceding Discover request with RequestType MDSCHEMA_MEMBERS. This is requesting the entire hierarchy. The size of this response is what is causing the performance issue.
Even if we use the single level [Date].[Date] hierarchy, it is still a huge response because we have dates for 100 years. We have a similar issue with other dimensions, but I am focusing on this one because you can test it against the Adventure Works cube.
Hope that clears it up.
Hi Gary,
Could you list the steps giving this result? I have put similar configuration for xmla data source
Rows="[Date].[Calendar]{[Date].[Calendar].[Date].&[20020409]}"
Measures="Internet Sales Amount"
And here is my xmla execute result:
Thanks,Plamen.