logo

drewdevault.com

[mirror] blog and personal website of Drew DeVault git clone https://hacktivis.me/git/mirror/drewdevault.com.git

In-praise-of-Postgres.md (5237B)


  1. ---
  2. title: In praise of PostgreSQL
  3. date: 2021-08-05
  4. outputs: [html, gemtext]
  5. ---
  6. After writing [Praise for Alpine Linux][0], I have decided to continue writing
  7. more articles in praise of good software. Today, I'd like to tell you a bit
  8. about [PostgreSQL][1].
  9. [0]: gemini://drewdevault.com/2021/05/06/Praise-for-Alpine-Linux.gmi
  10. [1]: https://www.postgresql.org
  11. Many people don't understand how old Postgres truly is: the first release[^1]
  12. was in July of 1996. It used this logo:
  13. [^1]: The first release of Postgre**SQL**. Its lineage can be traced further back.
  14. ![A "logo" which depicts the word "PostgreSQL" in a 3D chrome font bursting through a brick wall from space. No, seriously.](https://l.sr.ht/Ye7j.jpg)
  15. After 25 years of persistence, and a better logo design, Postgres stands today
  16. as one of the most significant pillars of profound achievement in free software,
  17. alongside the likes of Linux and Firefox. PostgreSQL has taken a complex problem
  18. and *solved* it to such an effective degree that all of its competitors are
  19. essentially obsolete, perhaps with the exception of SQLite.
  20. For a start, Postgres is simply an incredibly powerful, robust, and reliable
  21. piece of software, providing the best implementation of SQL.[^2]
  22. It provides a great deal of insight into its own behavior, and allows
  23. the experienced operator to fine-tune it to achieve optimal performance. It
  24. supports a broad set of SQL features and data types, with which I have always
  25. been able to efficiently store and retrieve my data. SQL is usually the #1
  26. bottleneck in web applications, and Postgres does an excellent job of providing
  27. you with the tools necessary to manage that bottleneck.
  28. [^2]: No qualifiers. It's straight-up the best implementation of SQL.
  29. Those tools are also exceptionally well-documented. The [PostgreSQL
  30. documentation][2] is *incredibly* in-depth. It puts the rest of us to shame,
  31. really. Not only do they have comprehensive reference documentation which
  32. exhaustively describes every feature, but also vast amounts of prose which
  33. explains the internal design, architecture, and operation of Postgres, plus
  34. detailed plain-English explanations of how various high-level tasks can be
  35. accomplished, complete with the necessary background to *understand* those
  36. tasks. There's essentially no reason to ever read a blog post or Stack Overflow
  37. answer about how to do something with Postgres — the official docs cover
  38. every aspect of the system in great depth.
  39. [2]: https://www.postgresql.org/docs/current/index.html
  40. The project is maintained by a highly disciplined team of engineers. I have
  41. complete confidence in their abilities to handle matters of performance,
  42. regression testing, and security. They publish meticulously detailed weekly
  43. development updates, as well as thorough release notes that equips you with
  44. sufficient knowledge to confidently run updates on your deployment. Their git
  45. discipline is also legendary — here's the [latest commit][3] at the time
  46. of writing:
  47. [3]: https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=aa769f80ed80b7adfbdea9a6bc267ba4aeb80fd7
  48. ```
  49. postgres_fdw: Fix issues with generated columns in foreign tables.
  50. postgres_fdw imported generated columns from the remote tables as plain
  51. columns, and caused failures like "ERROR: cannot insert a non-DEFAULT
  52. value into column "foo"" when inserting into the foreign tables, as it
  53. tried to insert values into the generated columns. To fix, we do the
  54. following under the assumption that generated columns in a postgres_fdw
  55. foreign table are defined so that they represent generated columns in
  56. the underlying remote table:
  57. * Send DEFAULT for the generated columns to the foreign server on insert
  58. or update, not generated column values computed on the local server.
  59. * Add to postgresImportForeignSchema() an option "import_generated" to
  60. include column generated expressions in the definitions of foreign
  61. tables imported from a foreign server. The option is true by default.
  62. The assumption seems reasonable, because that would make a query of the
  63. postgres_fdw foreign table return values for the generated columns that
  64. are consistent with the generated expression.
  65. While here, fix another issue in postgresImportForeignSchema(): it tried
  66. to include column generated expressions as column default expressions in
  67. the foreign table definitions when the import_default option was enabled.
  68. Per bug #16631 from Daniel Cherniy. Back-patch to v12 where generated
  69. columns were added.
  70. Discussion: https://postgr.es/m/16631-e929fe9db0ffc7cf%40postgresql.org
  71. ```
  72. [They're all like this](https://git.postgresql.org/gitweb/?p=postgresql.git).
  73. Ultimately, PostgreSQL is a technically complex program which requires an
  74. experienced and skilled operator to be effective. Learning to use it is a costly
  75. investment, even if it pays handsomely. Though Postgres has occasionally
  76. frustrated or confused me, on the whole my feelings for it are overwhelmingly
  77. positive. It's an incredibly well-made product and its enormous and
  78. still-growing successes are very well-earned. When I think of projects which
  79. have made the most significant impacts on the free software ecosystem, and on
  80. the world at large, PostgreSQL has a place on that list.