How do you go around structs ideally having less than 32 fields?

In the official docs, it’s written that ideally structs should have less than 32 fields (source here).

Do you go around that limitation? If yes, how?

It’s very easy for an ecto schema to have more than 32 fields, especially as your application grows in complexity …

Adding belongs_to already adds 2 fields to the struct (the association and the association_id keys).

1 Like

What problem are you solving?

The theoretical performance problems pointed in the official docs will be completely overshadowed by DB access and literally everything else in your app. You will never know they were there.

1 Like

You’re 100% right :white_check_mark:

A better question would have been

What is the concrete impact of having structs / schemas with more 32 fields or more.

You should always consult the guide Maps — Erlang System Documentation v28.0.2

3 Likes