Installing PostgreSQL

2 hours of SQL video using NASA's Cassini data. See why developers become data pros.
There are numerous ways to get a PostgreSQL server up and running - the easiest is usually your best choice!
I like to run Postgres locally, so I typically run Postgres.app because I'm working on a Mac. It's very flexible and is a drag/drop install.
You can also work with Docker if you like, but beware that you might run low on resources later in the course as we dive into millllllions of records. Here's a docker-compose file for you to get started with:
<span class="hljs-attr">version:</span> <span class="hljs-string">"3"</span>
<span class="hljs-attr">services:</span>
<span class="hljs-attr">postgres:</span>
<span class="hljs-attr">image:</span> <span class="hljs-string">postgres:13.3</span>
<span class="hljs-attr">environment:</span>
<span class="hljs-bullet">-</span> <span class="hljs-string">POSTGRES_USER=dee</span>
<span class="hljs-bullet">-</span> <span class="hljs-string">POSTGRES_PASSWORD=deedle</span>
<span class="hljs-bullet">-</span> <span class="hljs-string">POSTGRES_DB=cassini</span>
<span class="hljs-attr">ports:</span>
<span class="hljs-bullet">-</span> <span class="hljs-string">"8088:5432"</span>
<span class="hljs-attr">volumes:</span>
<span class="hljs-bullet">-</span> <span class="hljs-string">./data/pg:/var/lib/postgresql/data</span>
<span class="hljs-bullet">-</span> <span class="hljs-string">./csvs:/home</span>
<span class="hljs-attr">container_name:</span> <span class="hljs-string">pg</span>
<span class="hljs-attr">pgweb:</span>
<span class="hljs-attr">container_name:</span> <span class="hljs-string">pgweb</span>
<span class="hljs-attr">restart:</span> <span class="hljs-string">always</span>
<span class="hljs-attr">image:</span> <span class="hljs-string">sosedoff/pgweb</span>
<span class="hljs-attr">ports:</span>
<span class="hljs-bullet">-</span> <span class="hljs-string">"8080:8081"</span>
<span class="hljs-attr">links:</span>
<span class="hljs-bullet">-</span> <span class="hljs-string">postgres:postgres</span>
<span class="hljs-attr">environment:</span>
<span class="hljs-bullet">-</span> <span class="hljs-string">DATABASE_URL=postgres://dee:deedle@postgres:5432/cassini?sslmode=disable</span>
<span class="hljs-attr">depends_on:</span>
<span class="hljs-bullet">-</span> <span class="hljs-string">postgres</span>
Here are some fun aliases for you to pop into your .env file if you have a plugin that will auto load them into your shell:
<span class="hljs-built_in">alias</span> up=<span class="hljs-string">"docker-compose up"</span>
<span class="hljs-built_in">alias</span> down=<span class="hljs-string">"docker-compose down"</span>
<span class="hljs-built_in">alias</span> <span class="hljs-keyword">in</span>=<span class="hljs-string">"docker exec -it pg /bin/bash"</span>
If you're on Windows, it's probably easiest to download Postgres and run it as a service.
Clients
We'll be using the the shell for most of our work, but at times you might want to be working in a GUI. If you run the docker bits above, a GUI is there for you and should be running on port 8080 when you docker-compose-up.
I like Postico and have paid the $35 happily. It's Mac-only, so if you're on Windows I would encourage you to download the Azure Data Studio.
2 hours of SQL video using NASA's Cassini data. See why developers become data pros.