SAS SPM 2.x and the mysterious sas_wdetemptable
I have been trying to work out for ages what the sas_wdetemptable in the spm schema in the Mysql database is there for.
The reason I wanted to know is that over time there seems to be records in there and the table seems to just keep growing, especially in our development environment when we were doing lots of test SPM loads and calcs. When you are adding 10,000 odd rows to SPM every week this table had me almost as concerned as the sas_elementcolumn table.
A track to SAS Tech Support on this came back with nothing should be in there, truncate it.
We are just finishing moving all our SPM loads from our tried and true ‘out-of-the-box’ SAS DI Studio jobs (which no longer works with the latest SAS 9.1.3 Foundation patch), to the new ‘build it yourself’ BMF loads (please don’t ask!)
So I was watching the Mysql database today to see if I could diagnose what was causing a performance issue with the calcs, and finally I think I undertsand one of the uses for the sas_wdetemptable.
So this is what I think happens…..
When you submit the calc, SPM:
1) Reads any rows in the sas_elementcolumn table for the project/period you are calcing for (so in our case 120,000 reads).
2) Writes these records to the sas_wdetemptable (120,000 writes)
3) Deletes the records from the sas_wdetemptable (120,000 deletes)
4) Somehow merges the records in the sas_wdetemptable with the new calc’d value (no idea on this one as I couldn’t see it ) and then inserts them back into the sas_elementcolumn table (120,000 inserts)
5) Deletes these records from the sas_wdetemptable (120,000 writes)
So now I know why the calc takes 40 minutes and the Mysql database seems to get fragmented.
And the reason we had some left, I think it is because every now and again the Web Server or Mysql instance would get stopped mid calc in Dev, and then the records in sas_wdetemptables won’t get deleted (its got me think about whats in, or more importantly not in sas_elementcolumns though when this happens)
Weird thing is the Mysql database is not using a lot of memory or cpu for this work, so need to read up on tuning this beast me thinks.