SSAS: .Net Stored Procedure - Best Practices

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.

Print | posted on Friday, April 20, 2007 3:38 PM

Comments on this post

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

Requesting Gravatar...
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();
}
Left by Yuri Abele on Apr 24, 2007 12:49 AM

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

Requesting Gravatar...
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
Left by Darren Gosbell on Apr 26, 2007 12:03 PM

Your comment:

 (will show your gravatar)