Slow secondary index count from vinyl cache
## Кратко В tarantool очень дорого по ЦПУ выполнить `idx:count(key, {iterator = 'EQ'})` по неуникальному вторичному индексу винила даже после прогрева cache и без чтения страниц с диска. Например, на моем ноутбуке извлечение 526 строк из кэша винила занимает 1.4 мс. К примеру на 17 постгресе выполнение аналогичного по смыслу sql запроса занимает 0.6 мс. Целевой сценарий: ```lua idx:count({11, 0, 2022, 7, 15}, {iterator = 'EQ'}) ``` Ключ возвращает 526 строк. После warmup метрики показывают: ```text disk.iterator.read.pages = 0 disk.iterator.get.rows = 0 memory.iterator.lookup = 0 cache.get.rows = 526 * number_of_runs ``` То есть проблема не в дисковом I/O и не в ping-pong через read thread/cbus на page read. Основное время тратится в горячем vinyl secondary iterator path. ## Сборка тарантула ``` Tarantool 2.11.8-373-gd8215d65c Target: Darwin-arm64-RelWithDebInfo Build options: cmake . -DCMAKE_INSTALL_PREFIX=/Users/darthunix/git/tarantool/build-release -DENABLE_BACKTRACE=TRUE Compiler: AppleClang-21.0.0.21000101 C_FLAGS: -fexceptions -funwind-tables -fasynchronous-unwind-tables -fno-common -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong -fPIC -fmacro-prefix-map=/Users/darthunix/git/tarantool=. -std=c11 -Wall -Wextra -Wno-gnu-alignof-expression -Wno-cast-function-type -Werror CXX_FLAGS: -fexceptions -funwind-tables -fasynchronous-unwind-tables -fno-common -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong -fPIC -fmacro-prefix-map=/Users/darthunix/git/tarantool=. -std=c++17 -Wall -Wextra -Wno-invalid-offsetof -Wno-gnu-alignof-expression -Wno-cast-function-type -Werror ``` ## Репро [repro.lua](/uploads/de6f3b26bfe9c1a1506cb164b6a29dc1/repro.lua) ``` tarantool -i repro.lua ``` Результаты: ``` warmup_rows: 526 rows: 526 runs: 1000 total_ms: 1401.059 per_call_us: 1401.059 lookup: 1000 txw.iterator.lookup: 1000 cache.lookup: 1000 cache.get.rows: 526000 cache.put.rows: 527000 disk.iterator.read.pages: 0 disk.iterator.get.rows: 0 memory.iterator.lookup: 0 ``` Флеймграф: ![tarantool_vinyl_cache.svg](/uploads/dc982f06aad61c8ca2fa100a13da7578/tarantool_vinyl_cache.svg){width=900 height=389}
issue