The test inserted 200k rows with autocommit enabled which made it very slow. Wrapping the inserts inside a transaction gives the test a significant speed boost.