Plan looks good. ix22 definition is same as this.
CREATE INDEX ix22 ON selfiecash( DISTINCT ARRAY userId FOR userId IN usersInChat END) WHERE tbl=“msgs”;
It looks like you are using CB 5.0.0. In cbq shell
\set -profile timings;
select idCampaign , isRead , msg , server_date , toUser , type , user_date , usersInChat from test where tbl=“msgs” And Any And Every userId in usersInChat satisfies userId in [1,2] end;
Check “#stats” of each operator and see where it is taking time.