Postgres
Connect
psql -h <hostname> -U <username> -d <dbname>
List databases
\l
List tables for current database
\d
Describe a tables
\d+ table_name
Quit
\q
Create database create database ct_tableau;
Drop a database drop database ct_tableau;
Generate sample data
-- create very simple table
CREATE TABLE sample_table (
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
label TEXT,
created_at TIMESTAMP WITHOUT TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITHOUT TIME ZONE DEFAULT NOW()
);
-- populate with 10m records
INSERT INTO sample_table (label)
SELECT
'hash: ' || md5(random()::text)
FROM generate_series(1, 7000000);