Skip to content

Commit

Permalink
Remove concurrent index creation for partitioned tables
Browse files Browse the repository at this point in the history
  • Loading branch information
krisis committed Jan 25, 2022
1 parent 3839a99 commit c0f8a43
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions logsearchapi/server/db-migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func updateAccessKeyCol(ctx context.Context, c *DBClient) {
func addAccessKeyColAndIndex(ctx context.Context, c *DBClient) error {
queries := []string{
`ALTER table request_info ADD access_key text`,
`CREATE INDEX CONCURRENTLY request_info_access_key_index ON request_info (access_key)`,
`CREATE INDEX request_info_access_key_index ON request_info (access_key)`,
}

return c.runQueries(ctx, queries, func(err error) bool {
Expand All @@ -129,21 +129,21 @@ func addAccessKeyColAndIndex(ctx context.Context, c *DBClient) error {

func addAuditLogIndices(ctx context.Context, c *DBClient) error {
queries := []string{
`CREATE INDEX CONCURRENTLY audit_log_events_log_index ON audit_log_events USING btree ((log->>'requestID'))`,
`CREATE INDEX CONCURRENTLY audit_log_events_event_time_index ON audit_log_events (event_time desc)`,
`CREATE INDEX audit_log_events_log_index ON audit_log_events USING btree ((log->>'requestID'))`,
`CREATE INDEX audit_log_events_event_time_index ON audit_log_events (event_time desc)`,
}

return c.runQueries(ctx, queries, duplicateTblErr)
}

func addReqInfoIndices(ctx context.Context, c *DBClient) error {
queries := []string{
`CREATE INDEX CONCURRENTLY request_info_api_name_index ON request_info (api_name)`,
`CREATE INDEX CONCURRENTLY request_info_bucket_index ON request_info (bucket)`,
`CREATE INDEX CONCURRENTLY request_info_object_index ON request_info (object)`,
`CREATE INDEX CONCURRENTLY request_info_request_id_index ON request_info (request_id)`,
`CREATE INDEX CONCURRENTLY request_info_response_status_index ON request_info (response_status)`,
`CREATE INDEX CONCURRENTLY request_info_time_index ON request_info (time)`,
`CREATE INDEX request_info_api_name_index ON request_info (api_name)`,
`CREATE INDEX request_info_bucket_index ON request_info (bucket)`,
`CREATE INDEX request_info_object_index ON request_info (object)`,
`CREATE INDEX request_info_request_id_index ON request_info (request_id)`,
`CREATE INDEX request_info_response_status_index ON request_info (response_status)`,
`CREATE INDEX request_info_time_index ON request_info (time)`,
}

return c.runQueries(ctx, queries, duplicateTblErr)
Expand Down

0 comments on commit c0f8a43

Please sign in to comment.