Reading time: 10 minutes
PostgreSQL is the World’s most advanced Open Source Relational Database. The interview series “PostgreSQL Person of the Week” presents the people who make the project what it is today. Read all interviews here.
Please tell us about yourself, and where you are from.
My name is Daniele, I am an Italian software developer, currently living in London.
How do you spend your free time? What are your hobbies?
One of my favourite things to do, when I am not hacking, is photography, and to travel around with the excuse to find interesting places where to make photography. I also enjoy playing ukulele, but I am not interested in classical tunes and I prefer to rearrange ‘90s alternative music.
Any Social Media channels of yours we should be aware of?
I have a blog where I write sporadically, sometimes about photographic adventures, sometimes about hacking adventures. I am not very active on social media, but can be found on:
- And I impersonate psycopg on twitter, because elephants and snakes are not good at typing
Last book you read? Or a book you want to recommend to readers?
I haven’t been able to finish a book in a long time, although I have started many. Slaughterhouse 5 is maybe my favourite. So it goes.
Any favorite movie, or show?
I prefer films much more than shows: I get bored of shows pretty quickly. Among my favourite directors there are two both called Anderson: Wes Anderson for the colourful worlds he creates and portrays with deadpan irony (Moonrise Kingdom, The Grand Budapest Hotel) and Paul Thomas Anderson: his Magnolia is probably the film I love the most.
What does your ideal weekend look like?
My ideal weekend would tire me physically: it would see me dragging a camera and a tripod somewhere to make a long exposure, coming back covered in mud. I am happy to start a new week of work with my legs still aching from the weekend “rest”.
What’s still on your bucket list?
If I say that I would like to travel on a motorbike, does it sound too much like a mid-life crisis? In general, I am lucky: my bucket has a hole and my desires regularly trickle in my life, leaving little backlog.
What is the best advice you ever got?
“You can do X for 15 years and you will have not learned yet.” It wasn’t mentioned related to programming, or to photography, but it applies there as well.
When did you start using PostgreSQL, and why?
When I started university I had some experience hacking with Visual Basic and using Access when I needed a database. However I was growing a dislike for proprietary, closed tools, and VB couldn’t be defined as an elegant language by any mean. Looking for replacements, I quickly got to love Python. As for databases, the most used at the time was one which considered the 31st of February a legit date and boasted a backend called BLACKHOLE. Another database, less used, supposedly more complex, but seeming more reliable and with a much better support for complex SQL, was Postgres.
Do you remember which version of PostgreSQL you started with?
Probably it was 7.4, to compile with Cygwin on Windows 2000, as I wasn’t a Linux user yet.
Have you studied at a university? If yes, was it related to computers? Did your study help you with your current job?
I started with software engineering, but fell in love with the mathematics taught by my Calculus teacher in the first two years. When the more engineering-oriented courses started, I didn’t find them interesting, or relevant to what I wanted to do. So I moved to a mathematics course, to study the theoretical side of computer science, and hacked on my own will to learn the practical side of the craft. I think it turned out to be a great combination.
What other databases are you using? Which one is your favorite?
I use Redis as a key-value store for transient data, such as sessions. Postgres fits the bill for the data I really want to save. If I wanted to use an embedded db I would use SQLite, but I’m not working on any project which may benefit from it at the moment.
On which PostgreSQL-related projects are you currently working?
I have maintained Psycopg 2 for many years, and in the last year I have been writing Psycopg 3, which I would like to complete soon. It is a project I have been wanting to write for a long time, but not something I could have done while keeping a full-time job. I stopped working full-time in 2020, and now I am trying this crazy attempt at making a living out of writing code I want to give away for free, so I’m gathering sponsorships both to complete Psycopg 3 and to support me in the maintenance of other software libraries I have written and people rely on.
How do you contribute to PostgreSQL?
Psycopg has definitely been my most important contribution. Other things I have written and people use are PGXN Client (the “pip install” for Postgres), the PGMP library (to handle big big numbers and rationals in Postgres). I helped to salvage pg_reorg, which wasn’t maintained anymore, and forked it into pg_repack, which now, in turn, is in sore need of some proper maintenance. After Psycopg 3 is finished I could give it more care, if any sponsor would like to support me to do so.
Any contributions to PostgreSQL which do not involve writing code?
I take part in conferences every now and then but I don’t think I would do a good job as an advocate.
What is the most annoying PostgreSQL thing you can think of? And any chance to fix it?
I hope one day it will be possible to swap column positions!
What is the feature you like most in the latest PostgreSQL version?
FETCH FIRST n ROWS WITH TIES” was a very nice thing to find in PostgreSQL 13, because it allows to write efficient pagination (“
WHERE indexed_field > x LIMIT n”, instead of “
LIMIT n OFFSET x”, which has quadratic behaviour) and without fear of losing some records when “
indexed_field” is not unique, for instance when it is a timestamp.
Could you describe your PostgreSQL development toolbox?
I have a minimalistic attitude with my toolkit: I use the i3 window manager and a well configured vim. Each project I am (con)currently working on takes place on an i3 workspace, where I have an editor and a stack of shells to run tests and commands.
Which skills are a must have for a PostgreSQL developer/user?
Postgres is now a very broad platform and different areas can make use of different skills. You rarely have to know C, unless you are hacking in the core or an extension. Normally you will be a Postgres end-user and you may want to model the data that your application will manage: if you can visualise how you want to make your program work, usually there is a way to ask Postgres to implement that.
Do you use any git best practices, which makes working with PostgreSQL easier?
I keep the schema in manually written and commented on SQL files (not the ones generated by pg_dump), designed to be imported by “
psql -f”. Every time the schema requires a change, I write a migration file, a sequence of SQL DDL statements, to go together with the schema change in the same git changeset. I use a script (extended over the years and adapted to different environments) to apply the outstanding migrations and store the ones already applied in a table of the same database. The script can be run by other developers after a “
git pull”, in order to update the schema in their local development environments, and it is also run as part of the deployment procedure to update the schema in staging/production servers.
The SQL that Postgres can manage is amazingly expressive and by definition complete, so I don’t see the point of migration systems that have their own model to wrap Postgres DDL, such as Django Migrations: it seems such an overcomplicated and opaque system for a feature, “portable migrations”, of which I really don’t see the use case. Is it really important to write a migration working for both Postgres and SQLite, when the latter has only a fraction of the features? But when I wrote about my solutions I got quite some flak, so maybe this desire for minimalism is not widely shared.
Which PostgreSQL conferences do you visit? Do you submit talks?
When I am more active on Psycopg I tend to go around more and submit talks, so this year I have been to a few of them. Unfortunately only online, of course. I am looking forward to attending some IRL conferences as soon as possible, to reconnect with the people of the Postgres community I got to meet and talk with in the past years.
Do you think PostgreSQL has a high entry barrier?
Running Postgres, writing the first programs to use it as a database, is not very difficult. The replication landscape, when one single database server doesn’t suffice anymore, is probably a more complex matter. But starting from simpler things helps to understand how to proceed forward. Mastering everything Postgres can do may require time, just because the database is so feature rich, but you don’t need to use every single feature and the first steps are not so difficult.
What is your advice for people who want to start PostgreSQL developing - as in, contributing to the project. Where and how should they start?
If someone wanted to develop in the core, writing an extension could be useful (I did it with PGMP). But Postgres is not only the core: if you have an idea for a client tool it can be written in any language.
Do you think PostgreSQL will be here for many years in the future?
I see Postgres as a starting point for whatever will be the database of the future. The work done in the current releases in order to use different backends will make it even more so a platform rather than a single product. The first quantistic database that will be released will be PostgresQuant, and there will be endless ML threads discussing how terrible its name is.
Are you reading the -hackers mailinglist? Any other list?
I sometimes skim -hackers just to be in awe of the technical competence of the regulars there, and the level of scrutiny that each idea considered for the core takes. I receive, but not regularly read, a few others, such -general, -announce, and -performance.
Which other Open Source projects are you involved or interested in?
Python is one in which I am involved of course. Then I have scattered interests in other languages, for instance I would like to get more familiar with Rust, and I would really like to connect computer science with the creative side - music, video art, GANs, but I don’t seem to find the time, or maybe the inspiration.
On the Postgres side, one need I regularly have is to create small versions of large databases (for instance to give developers a meaningful sample of data for their local environments or to create staging environments). While working for a previous employer I wrote a tool (pg_seldump, for selective data dumps) which I would like to complete and polish to release. I think I was in the middle of writing an algorithm to walk over foreign keys to collect records that dumped records depend on (including recursive cases), when Psycopg 3 took over my dev time.
Anything else you like to add?
I think, with Psycopg 3, something unique happened. I asked the community and companies to be financially supportive to develop a free software library, and the response was really positive. I wish this could become a viable model for other free software creators. Other free software authors have shared their interest in such a model and I really hope it will become a recognised way to work.