Skip to content

Commit

Permalink
Stop creating index for now
Browse files Browse the repository at this point in the history
  • Loading branch information
nakabonne committed Jun 7, 2021
1 parent b0e276b commit b0a34a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pkg/datastore/mysql/ensurer/indexes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ CREATE INDEX event_key_name_project_id_created_at_desc ON Event (EventKey, Name,
-- Piped table indexes
--

-- index on `EnvIds` ASC
-- index on `ProjectId` ASC and `EnvIds` ASC
ALTER TABLE Piped ADD COLUMN EnvIds JSON GENERATED ALWAYS AS (IFNULL(data ->> "$.env_ids", '[]')) VIRTUAL NOT NULL;
CREATE INDEX piped_project_id_env_ids_asc ON Piped (ProjectId, EnvIds);
-- TODO: Create index on ProjectId and EnvIds
-- CREATE INDEX piped_project_id_env_ids_asc ON Piped (ProjectId, (CAST(EnvIds->'$' AS BINARY(16) ARRAY)));
2 changes: 1 addition & 1 deletion pkg/datastore/mysql/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func buildWhereClause(filters []datastore.ListFilter) string {
valLength := reflect.ValueOf(filter.Value).Len()
conds[i] = fmt.Sprintf("%s %s (?%s)", filter.Field, filter.Operator, strings.Repeat(",?", valLength-1))
case "JSON_CONTAINS":
conds[i] = fmt.Sprintf("%s(%s, '%q', '$')", filter.Operator, filter.Field, filter.Value)
conds[i] = fmt.Sprintf("%s(%s, ?, '$')", filter.Operator, filter.Field)
default:
conds[i] = fmt.Sprintf("%s %s ?", filter.Field, filter.Operator)
}
Expand Down

0 comments on commit b0a34a6

Please sign in to comment.