PostgreSQLのサンプルデータベース
PostgreSQLの学習・検証時に使用できるデータソースです。
別途データベースを作っておくと、データベースを削除するだけでサンプルデータを一掃できるので楽です。
※ダウンロード方法はLinuxターミナルのコマンドを記載しています
デスクトップ環境がある場合は、ソースからダウンロード可能です
■World
世界の地理情報や人口データベース
データ量は五千行程度
ソース
ダウンロード
curl -O https://ftp.postgresql.org/pub/projects/pgFoundry/dbsamples/world/world-1.0/world-1.0.tar.gz
tar -zxvf ./world-1.0.tar.gz
リストア
createdb -U postgres world
psql -U postgres -f ./dbsamples-0.1/world/world.sql world
ER図
■usda
米国農務省農業研究局。 2005. USDA 標準参照用栄養データベース、リリース 18。栄養データ研究所ホームページ、http://www.ars.usda.gov/ba/bhnrc/ndl
データ量は三十五万行程度
ソース
ダウンロード
curl -O https://ftp.postgresql.org/pub/projects/pgFoundry/dbsamples/usda/usda-r18-1.0/usda-r18-1.0.tar.gz
tar -zxvf ./usda-r18-1.0.tar.gz
リストア
createdb -U postgres usda
psql -U postgres -f ./usda-r18-1.0/usda.sql usda
ER図
■dvdrental
DVDレンタルショップのDB
後述のpagillaをシンプルにしたもの
約4万5千行
ソース
ダウンロード
curl -O https://www.postgresqltutorial.com/wp-content/uploads/2019/05/dvdrental.zip
unzip ./dvdrental.zip
リストア
createdb -U postgres dvdrental
pg_restore -h localhost -p 5432 -U postgres -d dvdrental ./dvdrental.tar
ER図
■pagilla
DVDレンタルショップのDB
ソース
ダウンロード
curl -O https://ftp.postgresql.org/pub/projects/pgFoundry/dbsamples/pagila/pagila/pagila-0.10.1.zip
unzip ./pagila-0.10.1.zip
リストア
createdb -U postgres pagilla
psql -U postgres -f ./pagila-0.10.1/pagila-schema.sql pagilla
psql -U postgres -f ./pagila-0.10.1/pagila-insert-data.sql pagilla
psql -U postgres -f ./pagila-0.10.1/pagila-data.sql pagilla
ER図
複雑で汚い図しか出ないので省略
■iso
国際標準化機構 (ISO) が国名およびそれに準ずる区域、都道府県や州といった地域のために割り振った地理情報の符号化
約五千行
ソース
ダウンロード
curl -O https://ftp.postgresql.org/pub/projects/pgFoundry/dbsamples/iso-3166/iso-3166-1.0/iso-3166-1.0.tar.gz
tar -zxvf ./iso-3166-1.0.tar.gz
リストア
createdb -U postgres iso
psql -U postgres -f ./iso-3166/iso-3166.sql iso
ER図
■french-towns-communes-francaises
フランスの町、コミューン
約三万五千行
ソース
ダウンロード
curl -O https://ftp.postgresql.org/pub/projects/pgFoundry/dbsamples/french-towns-communes-francais/french-towns-commune
s-francaises-1.0/french-towns-communes-francaises-1.0.tar.gz
tar -zxvf ./french-towns-communes-francaises-1.0.tar.gz
リストア
createdb -U postgres french-towns-communes-francaises
psql -U postgres -f ./french-towns-communes-francaises.sql french-towns-communes-francaises
ER図
■dellstone
Dell DVD ストア
3種類のデータベースが提供されています
詳しくは解凍ファイルのreadmeを参照ください
- 小 10MB
- 中 1 GB
- 大容量 100 GB
ソース
ダウンロード
sudo curl -O https://linux.dell.com/dvdstore/ds21_postgresql.tar.gz
tar -xvzf ds2_postgresql.tar.gz
リストア
createdb -U postgres dellstore
psql -U postgres -f dellstore2-normal-1.0.sql dellstore
ER図
■bitcoin
bitcoinの取引データ
1テーブルの時系列データ
約240万行
ソース
※アカウント登録が必要
リストア
CREATE TABLE transactions (
time TIMESTAMPTZ,
block_id INT,
hash TEXT,
size INT,
weight INT,
is_coinbase BOOLEAN,
output_total BIGINT,
output_total_usd DOUBLE PRECISION,
fee BIGINT,
fee_usd DOUBLE PRECISION,
details JSONB
);
CREATE INDEX hash_idx ON public.transactions USING HASH (hash);
CREATE INDEX block_idx ON public.transactions (block_id);
CREATE UNIQUE INDEX time_hash_idx ON public.transactions (time, hash);
\copy transactions FROM 'C:\Users\masami\Downloads\bitcoin_sample\tutorial_bitcoin_sample.csv' DELIMITER ',' CSV HE
ADER;
ER図
1テーブルなので省略
■pgbench
ベンチマークのために用意されているデータ
約10万行(ベンチを動かすことで調整可)
リストア
createdb -U postgres bench
pgbench -U postgres -i bench
ER図
■AirQualityUCI
イタリアの都市の現場に配備されたガス マルチセンサー デバイスの応答が含まれています。時間ごとの応答平均は、認定分析装置からのガス濃度参照値とともに記録されます
1テーブル約9000行
ソース
ダウンロード
curl -s -OL https://github.com/tensorflow/io/raw/master/docs/tutorials/postgresql/AirQualityUCI.sql
リストア
createdb -U postgres airquality
psql -U postgres -f ./AirQualityUCI.sql airquality
■フライトデータ
小(300MB)・中(700MB)・大(2.5GB)の3種類のフライトデータが提供されています
ソース
ダウンロード
中くらいのサイズのみ記載
curl -s -OL https://edu.postgrespro.com/demo-medium-en.zip
unzip demo-medium-en.zip
リストア
psql -f ./demo-medium-en-20170815.sql -U postgres
ER図
その他データセット