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 (5223B)


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