CREATE OR REPLACE FUNCTION gena() 
RETURNS _int4 AS
$$
SELECT array( 
	SELECT (100000*random())::int
	FROM generate_series( 0, 2 + (100*random())::int ) 
);
$$
LANGUAGE SQL VOLATILE;


\echo ============ FU = off =============
DROP TABLE IF EXISTS ta;
CREATE TABLE ta (
	a	int[]
);

CREATE INDEX taidx ON ta USING gin (a) with (fastupdate=off);
INSERT INTO ta (SELECT gena() FROM generate_series(1,100000));
VACUUM ANALYZE ta;


\echo ============ FU = on =============

DROP TABLE IF EXISTS ta;
CREATE TABLE ta (
	a	int[]
);

CREATE INDEX taidx ON ta USING gin (a) with (fastupdate=on);
INSERT INTO ta (SELECT gena() FROM generate_series(1,100000));
VACUUM ANALYZE ta;
