Skip to content

[5.x] Use joins for attribute option values instead of a relation#1203

Merged
royduin merged 15 commits intomasterfrom
feature/use-joins-lol
Feb 24, 2026
Merged

[5.x] Use joins for attribute option values instead of a relation#1203
royduin merged 15 commits intomasterfrom
feature/use-joins-lol

Conversation

@Jade-GG
Copy link
Collaborator

@Jade-GG Jade-GG commented Feb 19, 2026

This dramatically reduces the amount of models loaded. Performance-wise, this reduces loading time from ~250ms to ~240ms, for a performance gain of ~4%.

Interestingly, according to the debug bar there is no significant change in the amount of memory used. Most of this is probably made neglegible by how much overhead Laravel requires.

@indykoning
Copy link
Member

Looking at the screenshots, the option names are missing and are replaced by their id instead

indykoning
indykoning previously approved these changes Feb 23, 2026
DB::raw('IF(ISNULL(ANY_VALUE(eav_attribute_option_value.value)), null, JSON_ARRAYAGG(eav_attribute_option_value.value)) AS option_values'),
])
->leftJoin('eav_attribute_option', function (JoinClause $join) use ($model) {
return $join->on('eav_attribute_option.attribute_id', "{$model->getTable()}.attribute_id")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use the getQualifiedColumn here?

@royduin royduin merged commit de61a5d into master Feb 24, 2026
@royduin royduin deleted the feature/use-joins-lol branch February 24, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants