Skip to content

Instantly share code, notes, and snippets.

@bharath-kotha
Last active August 7, 2022 04:18
Show Gist options
  • Save bharath-kotha/0a6d849736374671e4d20230e31991de to your computer and use it in GitHub Desktop.
Save bharath-kotha/0a6d849736374671e4d20230e31991de to your computer and use it in GitHub Desktop.
How SELECT statement can cause disk write IO - create tables
CREATE TABLE author (
id bigserial primary key,
name varchar(64) not null, country varchar(64)
);
CREATE TABLE book (
id bigserial primary key,
title varchar(128) not null,
author_id bigint NOT NULL,
CONSTRAINT fk_books_author_id FOREIGN KEY (author_id) REFERENCES author(id)
);
CREATE INDEX idx_book_author_id ON book(author_id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment