Live data from Hacker News

Thin PostgreSQL Clones

github.com

31–37 of 37 posts

Re: Thin PostgreSQL Clones

#31
post #29

I just came across testcontainers this week, which seems to solve similar problems. Has anyone tried both solutions and can comment about their experiences with them?

It's also a great tool. However, as far as I know, Testcontainers just manages container-based dependencies but doesn't prepare the data in any way.

Re: Thin PostgreSQL Clones

#32
post #10

Earlier quoted context omitted.

I have always made clones of production data on my dev machine for testing -- it has the added benefit of also regularly testing my DB backup restoration process. How else do you test and optimize SQL queries that are only slow with production-size data? If the data is too big to fit on my machine, I might clone to a nearby colocated server. Testing your DB backup and restoration mechanism becomes even MORE important…

Do you also store customer personal details and credit cards locally too?

At least with our DB we tokenize protected information, so all you have in the database is a GUID, the actual sensitive information is stored elsewhere.

Re: Thin PostgreSQL Clones

#33
post #2

It’s a tool that clones Postgres databases. It’s not a clone of Postgres the application.

It's much more sophisticated than cloning - it's only cloning the changes between the databases instead of the full databases. Ie 10 x 1TB database is only taking 1TB on disk.

Re: Thin PostgreSQL Clones

#34
This is simply great for master data & content management. Fast clone, override/mask data for QA/dev/test.

All that's left is to diff what's changed between clone and main database, and merge the changes back up for a full, safe workflow for master data and content management.

Re: Thin PostgreSQL Clones

#35

This is simply great for master data & content management. Fast clone, override/mask data for QA/dev/test. All that's left is to diff what's changed between clone and main database, and merge the changes back up for a full, safe workflow for master data and content management.

Exactly! Great thought, it aligns with our vision.

(Postgres.ai founder here)

Re: Thin PostgreSQL Clones

#36
post #3

A little off topic, but you can convert simple text to PostgreSql scripts, https://text2db.com/

Interesting. How do you specify data types for columns or schema names for tables? For modern Postgres versions it's also recommended to use standard compliant identity columns rather than the proprietary serial "types"

Thanks for reviewing it.

>How do you specify data types for columns or schema names for tables?

  For now, to keep it simple, all datatypes will be created as varchar and foreign keys as int, to declare any other column as int, need to write id keyword anywhere in name when defining syntax.
> For modern Postgres versions it's also recommended to use standard compliant identity columns rather than the proprietary serial "types"

I have ran it in Postgres version 14 using psql(shell) and it is working fine, but I shall look into it.

Thanks for reviewing it Thanks

Re: Thin PostgreSQL Clones

#37
post #14

This looks like a really useful tool for staging and development environments, and it's even OSS that can be self-hosted! Does anybody here have any real-life experiences with it they could to share?

I'm using it (mostly locally at the moment) for semi-automating testing of django db data migrations, and it's really great.

I've previously spent a fair bit of time tuning postgres for fast/less durable settings to speed up testing, and this puts all of that to shame when you need to start with any non-trivial schema/data and revert back to it.

I had been testing out some ideas with `docker commit` to save derived images which included a premade db, then reverting to that, but I don't think it's worth bothering with since I found dblab.

Haven't yet tried using it CI, and I suspect it might need a somewhat-custom-than-normal VM setup to use ZFS than you could easily do on most hosted CI runners, but it's on my list of things to investigate/setup eventually.

Post reply on HN