Fireship · @fireship

PostgreSQL in 100 Seconds

Uploaded July 27, 2023 · Length 2:37

PostgreSQL in 100 Seconds

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.

  1. 0:00

    postgresql the most trusted name in Open

  2. 0:02

    Source relational databases its

  3. 0:05

    development dates all the way back to

  4. 0:06

    1986 at UC Berkeley under the direction

  5. 0:08

    of Michael Stonebreaker like other pure

  6. 0:11

    relational databases it stores data in

  7. 0:13

    tables columns and rows and uses

  8. 0:15

    structured query language to read and

  9. 0:17

    write data however postgres is

  10. 0:19

    technically an object relational

  11. 0:20

    database which means it can create its

  12. 0:22

    own custom data types to store objects

  13. 0:24

    with properties and support Advanced

  14. 0:26

    features like inheritance and

  15. 0:27

    polymorphism when writing data it runs

  16. 0:29

    fully acid compliant transactions but

  17. 0:32

    also adds its own special sauce called

  18. 0:34

    multiversion concurrency control which

  19. 0:36

    gives each transaction a snapshot of the

  20. 0:38

    database allowing multiple transactions

  21. 0:40

    to run at the same time without traffic

  22. 0:42

    jams or locks developers also love its

  23. 0:44

    extensibility queries can be reused by

  24. 0:46

    writing stored procedures and it even

  25. 0:48

    supports languages Beyond SQL like

  26. 0:50

    Python and c and it has a robust

  27. 0:52

    ecosystem of extensions like post GIS to

  28. 0:55

    provide geospatial data for apps like

  29. 0:57

    Uber or cytus who Shard and distribute

  30. 0:59

    the data base to any scale or PG

  31. 1:01

    embedding to give AI chatbots long-term

  32. 1:03

    memory and the list goes on to get

  33. 1:05

    started you can download and install it

  34. 1:07

    locally or better yet use a free Cloud

  35. 1:09

    database like neon which provides Auto

  36. 1:11

    scaling out of the box and a nice UI to

  37. 1:13

    manage your data in addition to a bunch

  38. 1:15

    of other Advanced features like

  39. 1:16

    branching create a new database then

  40. 1:18

    head over to the SQL Editor to run your

  41. 1:20

    first query or connect it to your IDE

  42. 1:21

    with an extension like SQL tools we

  43. 1:23

    could get started by creating a new

  44. 1:25

    table but because this is an object

  45. 1:26

    relational database let's begin by

  46. 1:28

    creating a custom data type which

  47. 1:30

    defines the structure of an object with

  48. 1:32

    corresponding properties and types

  49. 1:34

    what's awesome about postgres though is

  50. 1:35

    that we have more exotic data modeling

  51. 1:37

    options like arrays can be used by

  52. 1:39

    putting brackets in front of a type then

  53. 1:41

    make it a two-dimensional array by

  54. 1:43

    adding another set of brackets we also

  55. 1:44

    have Json data types to handle

  56. 1:46

    unstructured data and even key value

  57. 1:48

    pairs with extensions like h-store now

  58. 1:50

    that we have this custom type we can use

  59. 1:52

    it within one or more tables like one

  60. 1:54

    table for programmers and another for

  61. 1:56

    designers once the table is created we

  62. 1:58

    can then use an insert statement to add

  63. 1:59

    a row of data into it notice the use of