I have a node content type that needs to store four different int values:

  • Score A
  • Score B
  • Score C
  • Score D

Each node of the content type always has all four int values.

I could store this one of two ways:

  1. Store all four scores in a single Integer field that is limited to four values. (Set Score A to the 0 position, Score B to the 1 position, and so on.) (One field in total)
  2. Store each of the four scores as its own Integer field. (Four fields in total)

From a usability perspective, it's easier to have four fields because it's more obvious where each score is, and configuring views is easier.

However, from the perspective of performance, which is better?

  • 3
    This question cannot be answered, too many unknown parameters. You can only measure performance for a specific query on a specific environment, and we don't know the query/storage engine/config/etc you'll be using. The only reliable answer is test it yourself on your own environment with the query you'll be using. – Hudri Aug 10 '20 at 15:34
  • 3
    I agree with @Hudri, most times you would simply configure these four fields and never got into any performance problems. When you do, then a custom field type with four properties all in one database table would be the most efficient. – 4k4 Aug 10 '20 at 15:37
  • @Hudri Ok, thanks. I thought there might be a general recommendation for this, but I see now that there is not. – Patrick Kenny Aug 10 '20 at 16:03
  • 3
    I agree with @4k4's general recommendation: Just don't care :-) If you expect really huge traffic and really huge data sets, then a custom field type = one single DB table with 4 integer value columns sounds like a good start. But it still ends with "do tests on your own system". – Hudri Aug 10 '20 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.