Replies: 5 comments 10 replies
-
I think phpmyadmin should not be the way to edit values, as this is really a key/value table, we should not add an (unused) autoincremental ID, because the values are always deleted and newly saved. The number of operations are therefore limited.
Tested on my sites with a few million entries and this has a huge impact on performance
So far had never the issue with not enough space, but who knows... No feelings about this one.
This could probably the primary key we're looking for? |
Beta Was this translation helpful? Give feedback.
-
But they are not unique at all, I have for example an article custom field and it looks like that: item_id - field_id - value |
Beta Was this translation helpful? Give feedback.
-
Tested this. My plugin had 2 minutes response time for a search (many fields and 70k fields_values). |
Beta Was this translation helpful? Give feedback.
-
Please mind that this table can be used for filtering. Filtering is essential for medium to big websites, using custom fields. A typical (but simplified) sql query for getting item_id(s), based on custom field values from 2 distinct custom fields (ids: 2, 4) looks like:
The whole concept here, is based on crosschecking (inner joining) records returned based on their value. Considerations
Also, i am not sure that i understand the benefits of your approach to using json for storing multiple values. If you want to avoid duplication of information (1NF) and avoid partial dependencies (2NF), the way to do it is by creating 1 more table to store the values per custom field and then use their pk to store the item_id > field_value_id dependency. But again, i think this requires a lot of code changes and will break a lot of websites due to changes in the db schema. If the scope of that suggestion is just to improve performance, a unique index can be created, using all the 3 fields (field_id, item_id, value) with limits to the length of the value. |
Beta Was this translation helpful? Give feedback.
-
Would do, version 1.
And I would not bother with JSON, just a BIGTEXT for the value will be fine. Having "multiy type" columns (or tables) will give us only much headache with minimal gain. |
Beta Was this translation helpful? Give feedback.
-
Maintainers discussed 2 issues several times since custom fields have been introduced.
Pretty sure their are more things people like to change so this discussion is for this.
Changes to consider separately
Annotations
Possible solutions
I can think of the following changes:
Modification to the table
#__fields_values (changing the current table)
Alternative 1
do the same but just add in a new table to not break 3rd party which expect the database being unchanged
#__fields_values_second_try
Alternative 2
#__fields_values_3rd_try
All of them are only an idea and could be discussed.
Beta Was this translation helpful? Give feedback.
All reactions