disclaimer : brainless proposition (SELECT * FROM table WHERE (icount(ids) <= 1 AND ids[1] = 33) UNION ALL (SELECT * FROM table WHERE (icount(ids) > 1 AND ids && '{33}'));
pgsql-performance by date:
Соглашаюсь с условиями обработки персональных данных