Hello; I’ve really enjoyed working with CockroachDB for the past few months in my personal project.
Recently, after updating my local cockroach version to the newly released v1.1, I noticed that the automated tests in my project were taking much longer to complete.
Since each test is independent, I reset the database and reinstate the same default values for every test suite. To do this, I issue a
SHOW TABLES command and build a list of tables to
TRUNCATE. Then, for each test, I execute a single query to clear and recreate the default rows in the db:
BEGIN; TRUNCATE example1,example2,ex3,... CASCADE; COMMIT; BEGIN; INSERT INTO ...; INSERT INTO ...., INSERT INTO ...; ... COMMIT;
Also, I found that if I didn’t wrap the truncate command in its own transaction, the inserts would fail because the table does not exist for some reason at that moment:
Uncaught Error: Error: relation "example1" does not exist
I’d really like to start using v1.1, but this issue is keeping me at 1.0.6 as each test is taking ~15-20 seconds to complete where they used to only take ~0.33 s.
If it makes any difference, I’m using node v8.5.0 with node-postgres (pg) on macOS High Sierra 10.13.1 Beta (17B35a).