If you are into writing stored procedures for SSAS, then you owe it to yourself to checkout Mosha's latest post on Best Practices for ADOMD.NET stored procedures, it covers some really interesting stuff including things like preferring enumerators over iterators which can have a significant impact on performance.

Feedback

# re: SSAS: .Net Stored Procedure - Best Practices

Mosha,

with usage og Generics your Sorting example should be more faster:

private class TupleValue : IComparable<TupleValue>
{
private Tuple _Tuple;
internal Tuple Tuple
{
get { return _Tuple; }
private set { _Tuple = value; }
}
private decimal _Value;

public TupleValue(Tuple t, decimal v)
{
_Tuple = t;
_Value = v;
}

public int CompareTo(TupleValue other)
{
return other._Value.CompareTo(_Value);
}
}

public Set Order(Set InputSet, Expression SortExpression)
{
List<TupleValue> TupleValues = new List<TupleValue>(InputSet.Tuples.Count);

foreach (Tuple t in InputSet.Tuples)
{
TupleValues.Add(new TupleValue(t, (decimal)SortExpression.Calculate(t)));
}

int cTuples = InputSet.Tuples.Count;

TupleValues.Sort();

SetBuilder sb = new SetBuilder();

for (int i = 0; i < cTuples; i++)
{
sb.Add(TupleValues[i].Tuple);
}

return sb.ToSet();
} 4/24/2007 12:49 AM | Yuri Abele

# re: SSAS: .Net Stored Procedure - Best Practices

Thanks Yuri,

We have implemented this change in the code that is part of the Analysis Services Stored Procedure project. It is definitely an improvement, but the difference is not actually measureable. Even the sort procedure in Mosha's example executed faster than the resolution of the trace events. Most of the time is spent in fetching and caching the values.

Cheers
Darren 4/26/2007 12:03 PM | Darren Gosbell

Post a comment





 

 

News

About Me
I am a consultant, based in Melbourne Australia. I primarily work in the Business Intelligence area with SQL Server, although I also dabble in Content Management Server and .Net coding

Contact Me

MVP


Legal
Any and all code, software, examples, suggestions and anything else on this web site is available for you to use at your own risk. No warranty is expressed or implied.
Views and Opinions
The views and opinions expressed on this web site are not necessarily the views or opinions of my employer.

Subscribe in Bloglines Subscribe in NewsGator Online

Locations of visitors to this page

Twitter












Tag Cloud


Article Categories

Archives

Post Categories

.Net Blogs

Aussie Bloggers

BI Blogs

CMS Blogs

Syndication: