Hi all,
I am building a marketplace for my customer and unfortunately, I wasn’t able to convince him, that giving users over 100 attributes to describe an item is not the best way to go.
Those attributes will be true/false (boolean) type and I assume that on average there will be 10-20 with True values and the rest will be False.
Can you suggest to me which approach will be the best for storing this data and having the best performance when querying data?
I can see some approaches:
A. to keep items in a table where every attribute is a single boolean column
B. to keep a table with items, a table with attributes and a table that holds a connection between the table of items and the attributes where the value is True
C. To have a column in the Items table that will store a list of attributes that was marked as True in some form of a JSON structure.
Maybe there is any other approach.
Hi Arkadiusz,
First of all, you need to check if some of the attributes can be given value with respect to other attributes. Example- if user do not fill its house address, the address column value will be blank. then, we don’t need attribute like addressProvided(bool flag) for the same customer. We can handle those cases with the help of backend logic and you would not need any unnecessary data in your DB. Apart from that, we should only add those attributes which are absolutely necessary and may be modified/updated in later stages(apart from unique userid). Any feedback will be appreciated
Hi Deepak,
Thank you for your question. To be more precise: the project is about selling cars. There will be some dependent data like maker, year, and model, but there is also a long list of features like heated seats, 360 camera, lane assistant, parking assistant, ESP, ABS, ISO fix…) For every one of those, there will be a checkbox and the user will mark only those that apply to his vehicle.
After the seller will fill in the form, those attributes will be used for filtering, when buyers will browse the list of available vehicles.
As I have mentioned, I am looking for a way to set it up in a way that will give the best performance.
Hello,
I would go for the 3rd option - using a JSON column to store a configuration is a great fit for the feature. In fact, in my video about the JSON data type, I describe using it for a product configurator:
Hope this helps.
Regards,
Mark
Thank you and sorry for coming up with the question without proper digging