Optimized getting scaleId.