For a flexible and scalable v5 architecture, we need the best of the two worlds: First, we need the hamming distance for a fast retrieval -that is not strictly SQL- but, it can be easily integrated into most SQL-Servers, like PostgreSQL and it is already part of MariaDB.
Depending on the queries, like exact match queries, SQL + Indexing is a good choice, but when it comes to “IN” questions with variable sequence lengths, like categories or sizes, relational systems are not the best way to go since you either need more columns or more rows for efficient queries.
That is the reason why it is beneficial to combine SQL + JSON into a single unified architecture. With such an approach products can be easily stored as documents and modified on-the-fly with the ability to use different schemas for different customers.
However, to fully utilize the JSON advantage we need to be able to index also lists in JSON documents which is currently not possible with MariaDB.
To use PostgreSQL as a drop-in replacement, only the bitcount function is missing. A C-implementation is available and the performance is on-par with the implementation [1] in MariaDB. Since there is already a system package, there is no need to compile it yourself.