The developer from Domclick proposed an optimized method for image deduplication using 64-bit pHash and PostgreSQL. By implementing an autocrop function to remove uniform borders and storing both the original and mirrored versions of each image as 64-bit integers, the recall rate increased from 86% to 95% while maintaining 100% precision.

The search process is performed directly within PostgreSQL using the bit_count function on XOR results, which avoids the overhead of transferring data to the application layer. For datasets of up to 10 million records, this approach allows for efficient querying without the need for complex external indexing systems.

To handle narrow thresholds, the author suggests using a GIN index on image hash chunks. This method significantly speeds up searches, achieving results in 9 milliseconds compared to 850 milliseconds for a full table scan. However, for wide thresholds, a full scan with bit_count remains the most effective solution.

The study highlights that aggressive cropping remains a limitation for perceptual hashing. In cases with high volumes of cropped copies, the author recommends transitioning to local feature detection methods, such as SURF or AKAZE points, despite the increased complexity and storage requirements.

Practical recommendations include pre-processing images by applying EXIF orientation, handling alpha channels, and using SHA-256 for identifying exact duplicates. The author emphasizes that performance testing should be conducted with warmed caches to ensure accurate benchmarking.