SELECT COUNT(*) FROM nodes WHERE ARRAY_LENGTH(peers,1) = 1 AND SPLIT_PART(host::text, '/', 1)||':'||port::text != peers[1]; count ------- 365 (1 row)