Beehaw
  • Communities
  • Create Post
  • search
    Search
  • Login
  • Sign Up
cm0002 ( cm0002@toast.ooo )  to Programming@programming.dev · 4 months ago

All you need is PostgreSQL

ebellani.github.io

external-link
message-square
11
link
fedilink
  • cross-posted to:
  • programming@lemmy.ml
  • postgresql@programming.dev
26
external-link

All you need is PostgreSQL

ebellani.github.io

cm0002 ( cm0002@toast.ooo )  to Programming@programming.dev · 4 months ago
message-square
11
link
fedilink
  • cross-posted to:
  • programming@lemmy.ml
  • postgresql@programming.dev
Introduction The setup Laying the foundation The foundation: schemas and user roles for modularity Domains Accounts, managed and external Transfers, constrained by a state machine and temporal periods Transfer state history Account auditing Transactions, the immutable events On maintaining business rules via meaningful constraints The transfer state machine Transactions must fall within the transfer period Pending transactions require a pending transfer No future transactions when closing a transfer On capacity planning Working set estimation On write throughput Enabling HOT Updates for Transfers Making sure there are no Unused indexes OLTP Listing The history of a transfer OLAP Balance ledger Incremental maintenance via triggers On serializable isolation On decoupling Benchmarking the startup scenario Seed data Write script: full transfer lifecycle Read script: activity stream and balance Running the benchmark Results Conclusion Appendix A: Full code suite. Introduction There is a deep cultural reflex in modern engineering: whenever a problem appears, reach for a packaged solution instead of thinking from first principles. The result is architectural cargo culting and lots of missed opportunities. Some intentionally absurd-but-familiar examples:
alert-triangle
You must log in or # to comment.
  • sin_free_for_00_days ( sin_free_for_00_days@sopuli.xyz ) 
    link
    fedilink
    English
    arrow-up
    11
    ·
    4 months ago

    Seems, at a cursory look, to be a pretty solid intro to PostgreSQL. As @Valmond@lemmy.dbzer0.com commented, people sleep on SQLite. I think a lot of people skip SQLite because they think they need more. Hell, just about all my personal uses are covered with GNU recutils.

  • Valmond ( Valmond@lemmy.dbzer0.com ) 
    link
    fedilink
    arrow-up
    6
    ·
    4 months ago

    Or SQLite for embedded systems, and a NoSQL for no-sql, and MariaDB for FOSS DB.

    Did I forget anything?

    • Fedop ( Fedop@slrpnk.net ) 
      link
      fedilink
      arrow-up
      1
      ·
      4 months ago

      And DuckDb for columnar data storage

      • Valmond ( Valmond@lemmy.dbzer0.com ) 
        link
        fedilink
        arrow-up
        3
        ·
        4 months ago

        Like an excel sheet?

    • MonkderVierte ( MonkderVierte@lemmy.zip ) 
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      4 months ago

      Orbitdb or p2p. Also, XML.

  • TehPers ( TehPers@beehaw.org ) 
    link
    fedilink
    English
    arrow-up
    6
    ·
    4 months ago

    I swear Postgres always has new features whenever I look at it again.

    I was building a system for long running durable job queues with multiple workers and of course Postgres has a solution for that. You can do row-level locking in a transaction to “reserve” jobs for the duration of that transaction, and you can use SKIP LOCKED to skip over reserved jobs so workers don’t block each other. There’s also LISTEN and NOTIFY if you want pub/sub to track when jobs complete, for example.

    • MonkderVierte ( MonkderVierte@lemmy.zip ) 
      link
      fedilink
      arrow-up
      1
      ·
      4 months ago

      Postgres has scope creep?

      • TehPers ( TehPers@beehaw.org ) 
        link
        fedilink
        English
        arrow-up
        3
        ·
        4 months ago

        The row-level locking and SKIP LOCKED seem like appropriate features for a SQL-based DBMS. I find it odd that it’s not more common, actually. Even MSSQL doesn’t make any promises about locking just a row and might decide to lock a whole page instead, from what I read anyway.

        NOTIFY/LISTEN might be scope creep though. I’m not really sure what led to it being implemented.

  • 𝕽𝖚𝖆𝖎𝖉𝖍𝖗𝖎𝖌𝖍 ( sxan@midwest.social ) 
    link
    fedilink
    English
    arrow-up
    5
    ·
    4 months ago

    I hate admining PostreSQL, and groan when some app I want to use requires it. Don’t get me wrong: in a corp environment where someone else is responsible for backup/restore and permissions, pgsql > *. Tooling for it is great. It has every feature. But if I have to maintain it myself, I’ll chose a single file to copy and back up every time: sqlite FTW.

    • dallen ( dallen@programming.dev ) 
      link
      fedilink
      arrow-up
      3
      ·
      4 months ago

      CloudNativePG with barman backups makes it quite manageable.

      • towerful ( towerful@programming.dev ) 
        link
        fedilink
        arrow-up
        3
        ·
        4 months ago

        Yes. Not wanting to deal with more than a single file for backup/restore of your service?
        Use kubernetes.

        That doesn’t quite track

Programming@programming.dev

programming@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programming@programming.dev

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 60 users / day
  • 423 users / week
  • 1.72K users / month
  • 4.17K users / 6 months
  • 449 local subscribers
  • 28.8K subscribers
  • 2.97K Posts
  • 23.1K Comments
  • Modlog
  • mods:
  • snowe ( snowe@programming.dev ) 
  • Ategon ( Ategon@programming.dev ) 
  • UlrikHD ( UlrikHD@programming.dev ) 
  • bugsmith ( bugsmith@programming.dev ) 
  • Spyro ( Spyro@programming.dev ) 
  • BE: 0.19.15
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code