Skip to content

Instantly share code, notes, and snippets.

@okabe-yuya
Last active September 4, 2023 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save okabe-yuya/0897fae24b91b9403000916880cd87d2 to your computer and use it in GitHub Desktop.
Save okabe-yuya/0897fae24b91b9403000916880cd87d2 to your computer and use it in GitHub Desktop.
JOINがインデックス作成前後でどのようなパフォーマンス変化を生じさせるのかを検証した際に使用したテーブルです。
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