CREATE TABLE integer_test AS
(
	SELECT
		generate_series AS some_number
	FROM
		generate_series(-1000, 1000)
);
CREATE INDEX ON integer_test( some_number );
ANALYZE integer_test;

EXPLAIN ANALYZE SELECT some_number FROM integer_test WHERE some_number BETWEEN -2 AND 2;
EXPLAIN ANALYZE SELECT some_number FROM integer_test WHERE some_number <@ int4range(-2, 2, '[]');

EXPLAIN ANALYZE
WITH number_q AS MATERIALIZED
(
	SELECT
		-generate_series AS one_number,
		generate_series AS another_number
	FROM
		generate_series(0,10)
)
SELECT
	number_q.*,
	integer_test.some_number
FROM
	number_q
	JOIN integer_test ON (integer_test.some_number <@ int4range( number_q.one_number, number_q.another_number, '[]' ))
;

DROP TABLE integer_test;