Postgres, MVCC, and you or, Why COUNT(*) is slow (David Wolever)

Sdílet
Vložit
  • čas přidán 4. 07. 2024
  • It's hard to be a developer today without using a database… but they're often surrounded by an air of reverent mystery.
    One of those mysteries is why it's so slow to count all the rows in a table using COUNT(*). After all, it's just a matter of walking a b-tree and counting leaves… and that should be trivial to optimize!
    In this talk I'll answer the question of "why COUNT(*) is slow" by taking a deep dive into the the internals of Postgres' MVCC implementation, looking at:
    The question of "why COUNT(*) is slow"
    The on-disk storage layout and why, under the hood, it's not a b-tree
    What Postgres means by MVCC, with examples of the utility of transactions
    Introduce xid, xmin, xmax
    Discuss tuple visibility
    Explain VACUUM and xid wraparound
    Show off transaction isolation levels
    This talk is accessible to anyone who's used an SQL database, with enough depth that experienced developers will find some interesting tidbits.
    Presentation page -- 2017.pycon.ca/schedule/25/
  • Věda a technologie

Komentáře • 23

  • @MuhammadDaif
    @MuhammadDaif Před 8 měsíci +1

    I think my life has slightly changed to the better after watching this :D Thank you !

  • @SteveSand
    @SteveSand Před 5 lety +4

    Great presentation David, very understandable.

  • @dengan699
    @dengan699 Před 4 lety +6

    Introduction level talk..

  • @nicholaslipanovich827
    @nicholaslipanovich827 Před 6 lety +3

    This was really informative, thanks David!

  • @scotteza
    @scotteza Před 5 lety

    This is a great talk, thanks for posting it!

  • @kobi683
    @kobi683 Před 4 lety +2

    This is a great and informative lecture!

  • @sarvarnishonboyev4233
    @sarvarnishonboyev4233 Před 5 lety +1

    Thank you for awesome presentations, it was really useful and informative.

  • @CosmeJunior
    @CosmeJunior Před 3 lety

    Amazing video, must watch again

  • @cschandragiri
    @cschandragiri Před 3 lety

    Amazing explaination

  • @rpbhagato
    @rpbhagato Před 2 lety

    excellent presentation.

  • @Soham_Badjate
    @Soham_Badjate Před 10 měsíci

    great session!!

  • @kacy6014
    @kacy6014 Před 2 lety

    Great breakdown

  • @faraazali9589
    @faraazali9589 Před 10 měsíci

    Dude great explanation! 👍

  • @Patilsfact786
    @Patilsfact786 Před 2 lety

    Great informative

  • @alexandershchegretsov9615

    I love it, thanx man, it was interesting

  • @bobslave7063
    @bobslave7063 Před rokem

    best explanation ever!

  • @calvinchankf
    @calvinchankf Před 5 lety +3

    david thanks for your presentation.....however if i really need to count the total number of rows of a table which has over 10 million records, what should i do?

    • @alexanderroussakov2263
      @alexanderroussakov2263 Před 5 lety +1

      maintain it as single value in another table ;)

    • @Adaetro
      @Adaetro Před rokem

      If you semi recently performed "analyze" you probably have count number saved somewhere in statistics of that table

  • @ai__76
    @ai__76 Před 2 lety

    This was really informative... The sound and picture were not synced!

  • @jaskaranbindra9939
    @jaskaranbindra9939 Před 3 lety +1

    cool

  • @been2082
    @been2082 Před 5 lety

    From the video blog.sentry.io/2015/07/23/transaction-id-wraparound-in-postgres.html