PIM-3233 Deduplicate on query side instead of PHP

| Q                    | A
| -------------------- | ---
| Bug fix?             | Yes
| New feature?         | No
| BC breaks?           | No
| CI currently passes? | Yes
| Tests pass?          | Yes
| Scenarios pass?      | WIP
| Checkstyle issues?*  | No
| PMD issues?**        | No
| Changelog updated?   | Yes
| Fixed tickets        | PIM-3233
| DB schema updated?   | No
| Migration script?    | N.A.
| Doc PR               | N.A.