4 ms·
I am looking for ways to quickly load data into a PG database for local testing. An initial seed run is ok, but I want test suites to run on identical data sets
by kristiandupont 7y ago
I am looking for ways to quickly load data into a PG database for local testing. An initial seed run is ok, but I want test suites to run on identical data sets and since PG doesn't (yet) support nested transactions, I a currently use my seed database as a TEMPLATE for suite-specific databases.
It works reasonably well but creating the database with a template takes several seconds, even though my test data is fairly simple. I imagine it should be faster than anything I can do from my programming language (nodejs in my case), or is creating with templates slow for some reason that I don't know of?
- deleted 7y ago[deleted]
- aargh_aargh 7y agoNot an expert, but I'm curious - what use case is not sufficiently solved by savepoints?
- kristiandupont 7y agoThey might well be faster, I haven't tried. I just remember looking into them and thinking that it was more involved than what I had now so I decided against them.
- segmondy 7y agoPG supports nested transactions, save points. My team uses that extensively in their tests.
- kristiandupont 7y agoOk, so perhaps I should take a second look at those.