Modelling user preference system with categories
I have used Postgres's arrays to build a system to avoid joins. NB. I'm not using proper keys at the moment for simplicity.


One person's simplicity is another person's denormalized nightmare. Are you avoiding joins because of some already-analysed performance rationale? If so, fine. But if it's based on superstition, this is probably premature optimization.

All of that is to say, the "traditional" normalized relational approach to this would be:


A user table with an integer primary key
A food table with an integer primary key
A meal table with an integer primary key
A preference table with foreign keys to user, food and meal


Don't be afraid of join. Or if you are, consider using a denormalized or "tabular" database like Mongo.