Last active
September 4, 2023 12:14
-
-
Save okabe-yuya/0897fae24b91b9403000916880cd87d2 to your computer and use it in GitHub Desktop.
JOINがインデックス作成前後でどのようなパフォーマンス変化を生じさせるのかを検証した際に使用したテーブルです。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN; | |
CREATE TABLE IF NOT EXISTS students ( | |
student_id SERIAL PRIMARY KEY, | |
first_name VARCHAR(30) NOT NULL, | |
last_name VARCHAR(30) NOT NULL, | |
birthday DATE NOT NULL, | |
gender CHAR(1), | |
created_at TIMESTAMP, | |
updated_at TIMESTAMP | |
); | |
CREATE TABLE IF NOT EXISTS exam_results ( | |
exim_result_id SERIAL PRIMARY KEY, | |
student_id INTEGER NOT NULL, | |
subject_id CHAR(1), | |
score SMALLINT NOT NULL, | |
created_at TIMESTAMP, | |
updated_at TIMESTAMP, | |
FOREIGN KEY (student_id) REFERENCES students(student_id) | |
); | |
COMMIT; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment