drop table if exists arraytbl;
create table arraytbl (iarr int[]);

INSERT INTO arraytbl (iarr)
SELECT 
    (
        WITH random_data AS (
            SELECT 
                CASE 
                    WHEN random() < 0.1 THEN NULL
                    ELSE (random() * 1000)::int
                END AS value
            FROM generate_series(1, 1000)
        )
        SELECT array_agg(value)
        FROM random_data
    ) AS random_array
FROM generate_series(1, 100000); 

\timing on

create index on arraytbl using gin (iarr);
create index on arraytbl using gin (iarr);
create index on arraytbl using gin (iarr);

\timing off




