v.24.12New Feature

Add indexOfAssumeSorted Function to Optimize Search in Sorted Arrays

Add indexOfAssumeSorted function for array types. Optimizes the search in the case of a sorted in non-decreasing order array. The effect appears on very large arrays (over 100,000 elements). #72517 (Eric Kurbanov).
Introduces the indexOfAssumeSorted function for array types, which performs optimized searches on arrays sorted in non-decreasing order.

Why it matters

This feature addresses the inefficiency of searching large sorted arrays by enabling a faster search method that leverages the sorted order. It significantly improves performance for very large arrays (over 100,000 elements) by reducing the search complexity.

How to use it

Use the indexOfAssumeSorted function in your SQL queries on arrays that are sorted in non-decreasing order. For example:

SELECT indexOfAssumeSorted(your_sorted_array, value_to_find) FROM your_table;