- Jim Reese
- PowerBuilder
- Friday, 22 March 2024 04:13 PM UTC
We have a value that is stored as varchar, but it contains numeric data with a decimal to 2 places. It is an ID field, and that's just the way it has evolved over the years. For datawindow sorting, the application wraps the sort column name with double(colname) so that it will sort like a number. I recently discovered that with a result having about 8,000 rows, while other columns in the datawindow sort in less than a second, when this column is sorted on, it takes almost 2 minutes.
Changing the double() function to dec(), the sort time reduces to 18 seconds.
This app is so old, it may have been implemented prior to dec() support, but thought I'd put this out here as a heads up, dec() appears to be significantly more efficient than double() when converting a string to a number containing a decimal.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.