Skip to content

Commit

Permalink
chore: remove redundant selects and groups
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasheartman committed Jun 14, 2024
1 parent d4db4bd commit 0292183
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,12 @@ export class FeatureStrategiesReadModel implements IFeatureStrategiesReadModel {
.select(
'feature_name',
'environment',
'constraints',
this.db.raw(
'MAX(jsonb_array_length(constraints)) as constraint_count',
),
this.db.raw(
"MAX(coalesce(jsonb_array_length(value->'values'), 0)) as max_values_count",
),
)
.joinRaw('JOIN jsonb_array_elements(constraints) as value ON true')
.groupBy('feature_name', 'environment', 'constraints')
.groupBy('feature_name', 'environment')
.orderBy('max_values_count', 'desc')
.limit(2);

Expand Down

0 comments on commit 0292183

Please sign in to comment.