diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-07-31 00:59:42 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-07-31 00:59:42 +0900 |
| commit | 19a75493f5897685cb36c66c7bb3d31ea6a6bd2d (patch) | |
| tree | 1f5e52452763a1afa8c8ac00493cd395b09ed1ca | |
| parent | 422605f7a62ae3d32573387ab45e739b497357c6 (diff) | |
| download | phperkaigi-2025-albatross-19a75493f5897685cb36c66c7bb3d31ea6a6bd2d.tar.gz phperkaigi-2025-albatross-19a75493f5897685cb36c66c7bb3d31ea6a6bd2d.tar.zst phperkaigi-2025-albatross-19a75493f5897685cb36c66c7bb3d31ea6a6bd2d.zip | |
feat(backend): create indice on tables
| -rw-r--r-- | backend/schema.sql | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/backend/schema.sql b/backend/schema.sql index 3a4422f..4c63511 100644 --- a/backend/schema.sql +++ b/backend/schema.sql @@ -6,6 +6,7 @@ CREATE TABLE users ( is_admin BOOLEAN NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT NOW() ); +CREATE INDEX idx_users_username ON users(username); CREATE TABLE user_auths ( user_auth_id SERIAL PRIMARY KEY, @@ -14,6 +15,7 @@ CREATE TABLE user_auths ( password_hash VARCHAR(256), CONSTRAINT fk_user_id FOREIGN KEY(user_id) REFERENCES users(user_id) ); +CREATE INDEX idx_user_auths_user_id ON user_auths(user_id); CREATE TABLE problems ( problem_id SERIAL PRIMARY KEY, @@ -31,6 +33,7 @@ CREATE TABLE games ( problem_id INT, CONSTRAINT fk_problem_id FOREIGN KEY(problem_id) REFERENCES problems(problem_id) ); +CREATE INDEX idx_games_problem_id ON games(problem_id); CREATE TABLE game_players ( game_id INT NOT NULL, @@ -47,3 +50,4 @@ CREATE TABLE testcases ( stdout TEXT NOT NULL, CONSTRAINT fk_problem_id FOREIGN KEY(problem_id) REFERENCES problems(problem_id) ); +CREATE INDEX idx_testcases_problem_id ON testcases(problem_id); |
