Getting started with PostgreSQL
Notes from reading the guide
Intro
These are notes from reading the documentation of PostgreSQL.
Basics
- PostgreSQL uses a client/server model. A session consists of:
- a server process managing the database files, accepting connections to the database and performing database actions on behalf of clients. The server program is called
postgres
- the user’s client application wanting to perform database operations
- client and server can be on different hosts
- in this case, they communicate via a TCP/IP network connection
- PostgreSQL servers can handle multiple concurrent connections from clients (based on forks)
Setup Postgres on Mac following these steps
Download
Download the app
Create new server
Open the app and click initialize to create a new server
Install command line tool
sudo mkdir -p /etc/paths.d &&
echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp
Connect to database
install postgres
brew install postgres
rm -rf /usr/local/var/postgres
postgres -V
pg_ctl -D /usr/local/var/postgres start
initdb /usr/local/var/postgres start