String vs. Numeric Comparisons

I don’t know if you use a lot of Sum-If logic like I do. It’s a blessing and a curse. For example: sum(if(Category=’Sales’,Amount)). It just doesn’t scale up to tens of millions of rows. Even with only a million rows, if you have a sheet loaded with these expressions, QlikView will calculate the chart objects one at a time. The user may have to wait half a minute for the sheet to update.

Until set analysis comes out in version 8.5 (and it won’t fix everything), try using numeric comparisons. sum(if(CategoryCode=40,Amount)). In practice you’ll see a 10X speed improvement, but it’s possible to have bigger gains. The reason, as I learned from Nik Bowman, is that numeric comparisons can be done natively on the processor, where the string comparisons have a lot of overhead code.

No related posts.

This entry was posted in QlikView. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>