SELECt *FROM photosWHERe ( SELECt SUM(((phash::bigint # 2061756291569501157) >> bit) & 1) FROM generate_series(0, 63) bit ) <= 15

SELECt *FROM photosWHERe ( SELECt SUM(((phash::bigint # 2061756291569501157) >> bit) & 1) FROM generate_series(0, 63) bit ) <= 15