Skip to content

Commit

Permalink
feat: improve secondary indices for self service tables (#4179)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored Oct 29, 2024
1 parent eeb1355 commit 825aec2
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/client-go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
CREATE INDEX IF NOT EXISTS selfservice_login_flows_nid_id_idx ON selfservice_login_flows (nid ASC, id ASC);
CREATE INDEX IF NOT EXISTS selfservice_login_flows_id_nid_idx ON selfservice_login_flows (id ASC, nid ASC);
DROP INDEX IF EXISTS selfservice_login_flows_nid_idx;

CREATE INDEX IF NOT EXISTS selfservice_errors_errors_nid_id_idx ON selfservice_errors (nid ASC, id ASC);
DROP INDEX IF EXISTS selfservice_errors_nid_idx;

CREATE INDEX IF NOT EXISTS selfservice_recovery_flows_nid_id_idx ON selfservice_recovery_flows (nid ASC, id ASC);
CREATE INDEX IF NOT EXISTS selfservice_recovery_flows_id_nid_idx ON selfservice_recovery_flows (id ASC, nid ASC);
CREATE INDEX IF NOT EXISTS selfservice_recovery_flows_recovered_identity_id_nid_idx ON selfservice_recovery_flows (recovered_identity_id ASC, nid ASC);
DROP INDEX IF EXISTS selfservice_recovery_flows_nid_idx;
DROP INDEX IF EXISTS selfservice_recovery_flows_recovered_identity_id_idx;

CREATE INDEX IF NOT EXISTS selfservice_registration_flows_nid_id_idx ON selfservice_registration_flows (nid ASC, id ASC);
CREATE INDEX IF NOT EXISTS selfservice_registration_flows_id_nid_idx ON selfservice_registration_flows (id ASC, nid ASC);
DROP INDEX IF EXISTS selfservice_registration_flows_nid_idx;

CREATE INDEX IF NOT EXISTS selfservice_settings_flows_nid_id_idx ON selfservice_settings_flows (nid ASC, id ASC);
CREATE INDEX IF NOT EXISTS selfservice_settings_flows_id_nid_idx ON selfservice_settings_flows (id ASC, nid ASC);
CREATE INDEX IF NOT EXISTS selfservice_settings_flows_identity_id_nid_idx ON selfservice_settings_flows (identity_id ASC, nid ASC);
DROP INDEX IF EXISTS selfservice_settings_flows_nid_idx;
DROP INDEX IF EXISTS selfservice_settings_flows_identity_id_idx;

CREATE INDEX IF NOT EXISTS selfservice_verification_flows_nid_id_idx ON selfservice_verification_flows (nid ASC, id ASC);
CREATE INDEX IF NOT EXISTS selfservice_verification_flows_id_nid_idx ON selfservice_verification_flows (id ASC, nid ASC);
DROP INDEX IF EXISTS selfservice_verification_flows_nid_idx;
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
CREATE INDEX selfservice_login_flows_nid_id_idx ON selfservice_login_flows (nid ASC, id ASC);
CREATE INDEX selfservice_login_flows_id_nid_idx ON selfservice_login_flows (id ASC, nid ASC);
DROP INDEX selfservice_login_flows_nid_idx ON selfservice_login_flows;

CREATE INDEX selfservice_errors_errors_nid_id_idx ON selfservice_errors (nid ASC, id ASC);
DROP INDEX selfservice_errors_nid_idx ON selfservice_errors;

CREATE INDEX selfservice_recovery_flows_nid_id_idx ON selfservice_recovery_flows (nid ASC, id ASC);
CREATE INDEX selfservice_recovery_flows_id_nid_idx ON selfservice_recovery_flows (id ASC, nid ASC);
CREATE INDEX selfservice_recovery_flows_recovered_identity_id_nid_idx ON selfservice_recovery_flows (recovered_identity_id ASC, nid ASC);
DROP INDEX selfservice_recovery_flows_nid_idx ON selfservice_recovery_flows;
DROP INDEX selfservice_recovery_flows_recovered_identity_id_idx ON selfservice_recovery_flows;

CREATE INDEX selfservice_registration_flows_nid_id_idx ON selfservice_registration_flows (nid ASC, id ASC);
CREATE INDEX selfservice_registration_flows_id_nid_idx ON selfservice_registration_flows (id ASC, nid ASC);
DROP INDEX selfservice_registration_flows_nid_idx ON selfservice_registration_flows;

CREATE INDEX selfservice_settings_flows_nid_id_idx ON selfservice_settings_flows (nid ASC, id ASC);
CREATE INDEX selfservice_settings_flows_id_nid_idx ON selfservice_settings_flows (id ASC, nid ASC);
CREATE INDEX selfservice_settings_flows_identity_id_nid_idx ON selfservice_settings_flows (identity_id ASC, nid ASC);
DROP INDEX selfservice_settings_flows_nid_idx ON selfservice_settings_flows;
DROP INDEX selfservice_settings_flows_identity_id_idx ON selfservice_settings_flows;

CREATE INDEX selfservice_verification_flows_nid_id_idx ON selfservice_verification_flows (nid ASC, id ASC);
CREATE INDEX selfservice_verification_flows_id_nid_idx ON selfservice_verification_flows (id ASC, nid ASC);
DROP INDEX selfservice_verification_flows_nid_idx ON selfservice_verification_flows;
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
CREATE INDEX selfservice_login_flows_nid_idx ON selfservice_login_flows (nid ASC);
DROP INDEX selfservice_login_flows_nid_id_idx ON selfservice_login_flows;
DROP INDEX selfservice_login_flows_id_nid_idx ON selfservice_login_flows;

CREATE INDEX selfservice_errors_nid_idx ON selfservice_errors (nid ASC);
DROP INDEX selfservice_errors_errors_nid_id_idx ON selfservice_errors;

CREATE INDEX selfservice_recovery_flows_nid_idx ON selfservice_recovery_flows (nid ASC);
CREATE INDEX selfservice_recovery_flows_recovered_identity_id_idx ON selfservice_recovery_flows (recovered_identity_id ASC);
DROP INDEX selfservice_recovery_flows_nid_id_idx ON selfservice_recovery_flows;
DROP INDEX selfservice_recovery_flows_id_nid_idx ON selfservice_recovery_flows;
DROP INDEX selfservice_recovery_flows_recovered_identity_id_nid_idx ON selfservice_recovery_flows;

CREATE INDEX selfservice_registration_flows_nid_idx ON selfservice_registration_flows (nid ASC);
DROP INDEX selfservice_registration_flows_nid_id_idx ON selfservice_registration_flows;
DROP INDEX selfservice_registration_flows_id_nid_idx ON selfservice_registration_flows;

CREATE INDEX selfservice_settings_flows_nid_idx ON selfservice_settings_flows (nid ASC);
CREATE INDEX selfservice_settings_flows_identity_id_idx ON selfservice_settings_flows (identity_id ASC);
DROP INDEX selfservice_settings_flows_nid_id_idx ON selfservice_settings_flows;
DROP INDEX selfservice_settings_flows_id_nid_idx ON selfservice_settings_flows;
DROP INDEX selfservice_settings_flows_identity_id_nid_idx ON selfservice_settings_flows;

CREATE INDEX selfservice_verification_flows_nid_idx ON selfservice_verification_flows (nid ASC);
DROP INDEX selfservice_verification_flows_nid_id_idx ON selfservice_verification_flows;
DROP INDEX selfservice_verification_flows_id_nid_idx ON selfservice_verification_flows;
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
CREATE INDEX IF NOT EXISTS selfservice_login_flows_nid_idx ON selfservice_login_flows (nid ASC);
DROP INDEX IF EXISTS selfservice_login_flows_nid_id_idx;
DROP INDEX IF EXISTS selfservice_login_flows_id_nid_idx;

CREATE INDEX IF NOT EXISTS selfservice_errors_nid_idx ON selfservice_errors (nid ASC);
DROP INDEX IF EXISTS selfservice_errors_errors_nid_id_idx;

CREATE INDEX IF NOT EXISTS selfservice_recovery_flows_recovered_identity_id_idx ON selfservice_recovery_flows (recovered_identity_id ASC);
CREATE INDEX IF NOT EXISTS selfservice_recovery_flows_nid_idx ON selfservice_recovery_flows (nid ASC);
DROP INDEX IF EXISTS selfservice_recovery_flows_nid_id_idx;
DROP INDEX IF EXISTS selfservice_recovery_flows_id_nid_idx;
DROP INDEX IF EXISTS selfservice_recovery_flows_recovered_identity_id_nid_idx;

CREATE INDEX IF NOT EXISTS selfservice_registration_flows_nid_idx ON selfservice_registration_flows (nid ASC);
DROP INDEX IF EXISTS selfservice_registration_flows_nid_id_idx;
DROP INDEX IF EXISTS selfservice_registration_flows_id_nid_idx;

CREATE INDEX IF NOT EXISTS selfservice_settings_flows_nid_idx ON selfservice_settings_flows (nid ASC);
CREATE INDEX IF NOT EXISTS selfservice_settings_flows_identity_id_idx ON selfservice_settings_flows (identity_id ASC);
DROP INDEX IF EXISTS selfservice_settings_flows_nid_id_idx;
DROP INDEX IF EXISTS selfservice_settings_flows_id_nid_idx;
DROP INDEX IF EXISTS selfservice_settings_flows_identity_id_nid_idx;

CREATE INDEX IF NOT EXISTS selfservice_verification_flows_nid_idx ON selfservice_verification_flows (nid ASC);
DROP INDEX IF EXISTS selfservice_verification_flows_nid_id_idx;
DROP INDEX IF EXISTS selfservice_verification_flows_id_nid_idx;

0 comments on commit 825aec2

Please sign in to comment.