\timing on
create table ru as SELECT
        (
                SELECT string_agg(x, '') as str
                FROM (
                        SELECT chr(ascii('А') + (random() * 33)::integer)
                        FROM generate_series(1, 40 + b * 0)
                ) AS y(x)
        )
        FROM generate_series(1,1000000) as a(b);
create index on ru(str);
create table icu_ru as SELECT
        (
                SELECT string_agg(x, '')::TEXT COLLATE "ru-x-icu" as str
                FROM (
                        SELECT chr(ascii('А') + (random() * 33)::integer)
                        FROM generate_series(1, 40 + b * 0)
                ) AS y(x)
        )
        FROM generate_series(1,1000000) as a(b);
create index on icu_ru(str);



--Time: 100161.312 ms     icu: 3629.953            linux: 7502.430 (7457,449)      linux:icu:8580.712 (7413)


create table en as SELECT
        (
                SELECT string_agg(x, '') as str
                FROM (
                        SELECT chr(ascii('A') + (random() * 25)::integer)
                        FROM generate_series(1, 40 + b * 0)
                ) AS y(x)
        )
        FROM generate_series(1,1000000) as a(b);
create index on en (str);

create table icu_en as SELECT
        (
                SELECT string_agg(x, '')::TEXT COLLATE "en-x-icu" as str
                FROM (
                        SELECT chr(ascii('A') + (random() * 25)::integer)
                        FROM generate_series(1, 40 + b * 0)
                ) AS y(x)
        )
        FROM generate_series(1,1000000) as a(b);
create index on icu_en (str);

--Time: 30013.260 ms (29407.387)   icu: 2810.502    linux:5969.274 (5909)      linux:icu: 6548,849 (5919)

