> Maybe it will be useful for you! Or maybe there is already some built-in way > to treat cidr columns like ranges? There is GiST operator class since version 9.4 and SP-GiST operator class on version 9.6: CREATE INDEX ON tracked_ip_address USING gist (ip_address inet_ops); CREATE INDEX ON tracked_ip_address USING spgist (ip_address); Performance would change depending on the dataset. I am more confident from SP-GiST one. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general