Dimitri Fontaine
tapoueh.org · Personal blog · on HN since 2012
Dimitri Fontaine, a PostgreSQL developer and author of pgloader, writes about Postgres, SQL features, and database modeling.
What HN saysHN commenters recommend his books and posts, especially on window functions, and cite him on listen/notify and timestamp handling.
48HN people shared it
21linked it in comments
51stories submitted
195story points
3 months agolast shared
2012people per year2026
Most-shared posts
- 1Why is pgloader so much faster? (2014)6 people · 4 points · first shared 2019 · discussion on HN
- 2Homepage4 people · first shared 2015
- 3PostgreSQL Listen/Notify3 people · 7 points · first shared 2018 · discussion on HN
- 4Database Modelization Anti-Patterns3 people · 4 points · first shared 2018 · discussion on HN
- 5Understanding (SQL) Window Functions3 people · 1 points · first shared 2015 · discussion on HN
- 6Aggregating NBA data, PostgreSQL vs MongoDB2 people · 54 points · first shared 2014 · 8 comments on HN
- 7Understanding PostgresSQL window functions (2013)2 people · 22 points · first shared 2017 · 2 comments on HN
- 8PostgreSQL Data Types: Date, Timestamp, and Time Zones2 people · 17 points · first shared 2018 · 7 comments on HN
- 9PostgreSQL: Queen, Princesses, and Workers2 people · 4 points · first shared 2017 · discussion on HN
- 10PostgreSQL as a Microservice (2021)2 people · 4 points · first shared 2021 · discussion on HN
- 11Turn your PostgreSQL queries into Charts2 people · 4 points · first shared 2014 · discussion on HN
- 12PostgreSQL Concurrency: Isolation and Locking2 people · 4 points · first shared 2018 · discussion on HN
- 13PostgreSQL Data Types: JSON (2018)2 people · 3 points · first shared 2018 · discussion on HN
- 14How to Write SQL2 people · 3 points · first shared 2017 · 1 comments on HN
- 15SQL and Business Logic2 people · 2 points · first shared 2017 · discussion on HN
What HN people wrote when they linked it
craigkerstiens · 2017-11-06
As someone that cares greatly about the Postgres ecosystem there aren't nearly enough books out there, so really excited to see this one come to life. Instead of targeting DBAs the focus on app devs is very refreshing so that people can start to leverage more of the awesome in Postgres. I haven't yet read the book myself but absolutely will.
If you're curious to read some of Dimitri's writing ahead of time his blog is also a great resource - http://tapoueh.org/
ForHackernews · 2021-11-10
It's maybe not a great post, it was just one that came up when I searched.
> JDBC driver cannot receive asynchronous notifications.
Maybe their example is limited by the choice of client library.
This might be a better example? https://tapoueh.org/blog/2018/07/postgresql-listen-notify/
Or the offical postgres docs are:
https://www.postgresql.org/docs/14/sql-notify.html
https://www.postgresql.org/docs/14/sql-listen.html
https://www.postgresql.org/docs/14/libpq-notify.html
natmaka · 2019-10-30
A way to develop along those lines without much of the potential hassle is exposed in Dimitri Fontaine's books.
https://tapoueh.org/
taffer · 2019-03-31
I think you misunderstood how timestamps work in PostgreSQL. Timestamptz is always saved as UTC. Only in exceptional cases where you need to store something in local time, such as a scheduled event that is not in UTC, you should use the timestamp WITHOUT TZ. This is also what well-known PostgreSQL developers recommend: https://tapoueh.org/blog/2018/04/postgresql-data-types-date-timestamp-…
ssfak · 2015-09-11
For windows functions a good tutorial can be found at http://tapoueh.org/blog/2013/08/20-Window-Functions
Postgresql also has good support for SQL-99 : http://www.slideshare.net/MarkusWinand/modern-sql
WITH clauses (CTE) are great, but they are "optimization fences" in Postgresql : http://blog.2ndquadrant.com/postgresql-ctes-are-optimization-fences/
ICWiener · 2015-03-01
My own point of view is biased, admittedly, but I couldn't stop thinking that Common Lisp was relevant for each item in your list.
Of course, much isn't built-in, but this is not as bad as it sounds: concurrent channels are not part of the language specification, but you can install the "calispel" or "cl-actors" libraries that gives you what looks like primitive constructs.
Regarding "modern" languages, I like this quote from the author of pgloader:
"I switched from Python to Lisp because I wanted a modern language" (also transcribed as: "[...] in searching for a modern programming language the best candidate I found was actually Common Lisp."; see http://tapoueh.org/blog/2014/05/14-pgloader-got-faster.html)
dim · 2015-01-22
I'm told by one of the FOSDEM PGDAY conference organizers: "I believe they won't be". Sorry about that. The slides are going to be available on http://tapoueh.org/ and http://pgloader.io/ though.
jillesvangurp · 2019-06-04
I wish them well but fear this won't work out for them. This sounds like a smart move until you realize that they are just one of many players in a crowded market and that this actually decreases their value proposition for end users and external contributors. Having less of both is bad news for an OSS project, no matter how you spin it.
The way I see it this type of company has a short term value that derives from them being first (more or less) to market with whatever it is they do well. In this case, their thing is having a sharded/clustered db that can replicate across datacenters and with serialized transactions.
Awesome, that's a great thing to have and it will take other databases a while to get there. But they will eventually and that matters. This stuff commoditizes quite rapidly. It's based on published research by Google half a decade ago and people can look at the source code and algorithms. It's just a matter of time before somebody else figures out how to replicate what they do in some other product. Somebody like e.g. the postgresql developers: https://tapoueh.org/blog/2018/07/postgresql-concurrency-isolation-and-… and https://pgdash.io/blog/postgres-11-sharding.html. It's probably not perfect yet but they are obviously heading the same direction and there's a notion of good enough and diminishing returns.
When it does catch up, it all reverts to which is the best product in the market. Part of that is features but another part of that is a robust…
morenoh149 · 2018-09-28
If you namedrop something always link https://tapoueh.org/
tmtvl · 2026-03-12
Well, besides pgloader, which achieved a 20~30x speedup via a rewrite from Python to Common Lisp (<https://tapoueh.org/blog/2014/05/why-is-pgloader-so-much-faster/>), there is also this little organisation called NASA which has a collection of theorem proving libraries called variously PVSLib or NASALib (<https://github.com/nasa/pvslib>).
There is a lot more as well, of course, but these two are clear examples of Common Lisp being used in 'the real world'.
vindarel · 2023-01-11
CL is used in a wild range of domains. Web apps to industrial-grade theorem provers to quantum compilers etc.
Here's an overview for 2022: https://lisp-journey.gitlab.io/blog/these-years-in-common-lisp-2022-in…
companies: https://github.com/azzamsa/awesome-lisp-companies/
pgloader went from Python to CL: https://tapoueh.org/blog/2014/05/why-is-pgloader-so-much-faster/
my take on why lisp vs python: https://lisp-journey.gitlab.io/pythonvslisp/
rahimnathwani · 2022-11-08
"Keep all logic out of the database. It already is the slowest point. And hardest to scale up."
I don't think this is true in all cases. Sure, ORMs are awesome, but sometimes you need to write SQL queries by hand, and those queries necessarily implement some business logic (even if they're just retrieving data).
Nice explanation here:
https://tapoueh.org/blog/2017/06/sql-and-business-logic/
zodmaner · 2019-03-06
pgloader [0] is one example.
Interestingly, it was originally written in Python, but the author decided to rewrite the entire thing in Common Lisp due mainly to Python's poor performance and the lack of native thread support. The result Common Lisp version is 30 times faster than the old Python one. More info can be found in the author's blog post [1].
[0] https://pgloader.io/
[1] https://tapoueh.org/blog/2014/05/why-is-pgloader-so-much-faster/
tapoueh · 2017-11-06
So that you can receive updates if I make some. You don't have to, though, read http://tapoueh.org/blog/2017/11/mastering-postgresql-in-application-de… where you will find the full Table of Contents, or just buy the book ;-)
alpos · 2017-11-06
Not really feeling sold on this.
It's called "Mastering PostgreSQL" but the site reads like it's trying to convince beginner programmers that SQL iteself is useful.
Even the case made here: http://tapoueh.org/blog/2017/11/mastering-postgresql-in-application-de…
seems like it would only be convincing to someone who has never had to write much SQL and also has not already had to do a pattern like that in an API call.
lukaseder · 2017-01-18
I always link to this article:
http://tapoueh.org/blog/2013/08/20-Window-Functions
joevandyk · 2014-06-11
Also, postgresql has HyperLogLog as an extension: http://tapoueh.org/blog/2013/02/25-postgresql-hyperloglog
tinodb · 2024-10-31
I’m a bit surprised to hear that is the state of migrations in Rails. Being a Django developer I’m used to having most of the points you mention covered for a really long time already.
It’s timeless by looking at a captured schema, that doesn’t change with later code changes. Which means you can’t import / use methods of models and have to copy those over. So a different way than using the vcs for this, but still.
Not sure I’d name the second point “scalable”, but you can easily do data migrations as well.
It is really easy to use!
And you can certainly write tests for it, although it isn’t included in the framework [0]. But you can do that with just SQL too [1].
What I find much harder with (somewhat) larger dbs, is is a) determining whether it will lock up too much and b) whether it backwards compatible (so that you can roll back). Which is splitting in these pre- and post-migration steps as the article mentions. We currently use a linter for that but it is still a bit basic [2].
[0] https://www.caktusgroup.com/blog/2016/02/02/writing-unit-tests-django-…
[1] https://tapoueh.org/blog/2017/08/sql-regression-tests/
[2] https://github.com/3YOURMIND/django-migration-linter
junke · 2016-07-18
This is more related to a mindset than a list of features. By the way, "modern" and "new" have different meanings[0]. Even if a good deal of features from Lisp are incorporated in newer languages, what makes Lisp interesting is how everything is designed to bring a cohesive dynamic environment. Trace, debug, macroexpand, change the readtable, change the pretty-printer, change evaluation rules, types, conditions and restarts, special variables, around/before/after CLOS methods, the MOP, etc. all those little things contribute in making programs that can evolve, not in a hacky way but as part of the language philosophy.
I also like the idea that programs should strive to be correct first and fast second, while effectively providing ways to profile and optimize code, tune or deactivate the GC, etc.
[0] I switched from Python to Lisp because I wanted a modern language (http://tapoueh.org/confs/2014/05/05-ELS-2014)
takeda · 2015-03-02
The SQL can look a bit complex at first, and advanced queries can look complex, but MongoDB is quite limited what operations you can do with it, so the SQL queries that correspond to MongoDB operations are fairly simple.
Here's a documentation from MongoDB which could be used the other way as well:
http://docs.mongodb.org/manual/reference/sql-comparison/
For normal use you really need 4 operations:
SELECT - query data
INSERT - inserting data
UPDATE - modifying existing data
DELETE - remove data
Everything else is either used for database maintenance or DDL (Data Definition Language, defining how the data is stored) commands.
The DDL is the main reason why some organization are considering using MongoDB, they believe that by removing the schema (definition how data is stored) they will get more flexibility, the problem with it is that if you use MongoDB you still will have schema, the issue is that the schema will be enforced by your application. And if you don't enforce the structure you'll end up with quite a mess, and very complex code.
Also if you use Java (or JVM based language) there are many frameworks that supposed to help interacting with database each has their strengths and weaknesses. There's one called JOOQ[1] that allows you to write SQL queries in Java in a way very similar to MongoDB.
Edit: There's also article about MongoDB aggregate functions and equivalent PostgreSQL:…
wwfn · 2023-01-10
I'm also very curious for hear from expert lispers. I've tried to find the sweat spot where lisp would fit better than what I already know: shell for glue and file ops, R for data munging and vis, python to not reinvent things, perl/core-utils for one liners. But before I can find the niche, I get turned off by the amount of ceremony -- or maybe just how different the state and edit/evaluate loop is.
I'm holding onto some things that make common lisp look exciting and useful (static typing[0], APL DSL[1], speed [2,3,4]) and really want to get familiar with structural editing [5]
[0] https://github.com/phantomics/april
[1] https://github.com/coalton-lang/coalton/
[2] https://renato.athaydes.com/posts/revisiting-prechelt-paper-comparing-…
[3] https://github.com/fukamachi/woo/blob/master/benchmark.md
[4] https://tapoueh.org/blog/2014/05/why-is-pgloader-so-much-faster/
[5] https://github.com/drym-org/symex.el