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?
Thin PostgreSQL Clones
31–37 of 37 posts
Re: Thin PostgreSQL Clones
#32Earlier 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?
Re: Thin PostgreSQL Clones
#33It’s a tool that clones Postgres databases. It’s not a clone of Postgres the application.
Re: Thin PostgreSQL Clones
#34All 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
#35This 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.
(Postgres.ai founder here)
Re: Thin PostgreSQL Clones
#36A 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"
>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
#37This 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'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.