How to optimize query for text array in PostgreSQL using `@>` operator
If the strings are from a restricted set, you can define an ENUM datatype.  This translates the strings to integers behind the scenes.

create type alph as enum ( 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');

create table j as select floor(random()*100)::int, array_agg(substring('abcdefghijklmnopqrstuvwxyz',floor(random()*26)::int+1,1)) from generate_series(1,10000000) f(x) group by x%1000000;
create table j2 as select floor, array_agg::alph[] from j;


I get about a 2 fold speed improvement by doing:

select * from j2 where  array_agg @&gt; '{a,b}';


rather than 

select * from j where  array_agg @&gt; '{a,b}';


If I include the condition and floor=7 (after creating an index on "floor"), then both queries are so fast that any difference in speed can not be reliably detected.

This seems like the essence of premature optimization to me.