Fireship · @fireship
PostgreSQL in 100 Seconds
Uploaded July 27, 2023 · Length 2:37
Summary
postgresql basics explained in 100 seconds, covering data types, transactions, and querying
- postgresql
- database
- sql
- object relational database
- data modeling
- transactions
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
postgresql the most trusted name in Open
- 0:02
Source relational databases its
- 0:05
development dates all the way back to
- 0:06
1986 at UC Berkeley under the direction
- 0:08
of Michael Stonebreaker like other pure
- 0:11
relational databases it stores data in
- 0:13
tables columns and rows and uses
- 0:15
structured query language to read and
- 0:17
write data however postgres is
- 0:19
technically an object relational
- 0:20
database which means it can create its
- 0:22
own custom data types to store objects
- 0:24
with properties and support Advanced
- 0:26
features like inheritance and
- 0:27
polymorphism when writing data it runs
- 0:29
fully acid compliant transactions but
- 0:32
also adds its own special sauce called
- 0:34
multiversion concurrency control which
- 0:36
gives each transaction a snapshot of the
- 0:38
database allowing multiple transactions
- 0:40
to run at the same time without traffic
- 0:42
jams or locks developers also love its
- 0:44
extensibility queries can be reused by
- 0:46
writing stored procedures and it even
- 0:48
supports languages Beyond SQL like
- 0:50
Python and c and it has a robust
- 0:52
ecosystem of extensions like post GIS to
- 0:55
provide geospatial data for apps like
- 0:57
Uber or cytus who Shard and distribute
- 0:59
the data base to any scale or PG
- 1:01
embedding to give AI chatbots long-term
- 1:03
memory and the list goes on to get
- 1:05
started you can download and install it
- 1:07
locally or better yet use a free Cloud
- 1:09
database like neon which provides Auto
- 1:11
scaling out of the box and a nice UI to
- 1:13
manage your data in addition to a bunch
- 1:15
of other Advanced features like
- 1:16
branching create a new database then
- 1:18
head over to the SQL Editor to run your
- 1:20
first query or connect it to your IDE
- 1:21
with an extension like SQL tools we
- 1:23
could get started by creating a new
- 1:25
table but because this is an object
- 1:26
relational database let's begin by
- 1:28
creating a custom data type which
- 1:30
defines the structure of an object with
- 1:32
corresponding properties and types
- 1:34
what's awesome about postgres though is
- 1:35
that we have more exotic data modeling
- 1:37
options like arrays can be used by
- 1:39
putting brackets in front of a type then
- 1:41
make it a two-dimensional array by
- 1:43
adding another set of brackets we also
- 1:44
have Json data types to handle
- 1:46
unstructured data and even key value
- 1:48
pairs with extensions like h-store now
- 1:50
that we have this custom type we can use
- 1:52
it within one or more tables like one
- 1:54
table for programmers and another for
- 1:56
designers once the table is created we
- 1:58
can then use an insert statement to add
- 1:59
a row of data into it notice the use of


