[Haskell-cafe] Property checks and PostgreSQL?

Ignat Insarov kindaro at gmail.com
Sat Mar 13 23:06:41 UTC 2021


> Do you know where the majority of the time is spent? I.e. can you just drop the schema without re-creating the cluster? I'd guess it'd be fast but I don't know your setup.

The first step would be to keep the cluster, yes. It takes a few
seconds, although we can use a `tmpfs` backed by RAM to cut this down
to about one second. But initializing the data base from prepared
`*.sql` files also takes a few seconds.

> At $WORK we do this: property tests on PSQL data dropping data between tests, but we know which tables are modified so we can just truncate the affected ones.

So how exactly do you do that? Like, do you write the SQL statements
needed to reset the data base for every check by hand? And what sort
of statements do you use? Do you drop the table or delete the rows?

It would be ideal if I could somehow detect the tables that were
touched and reset them automatically. But I cannot think of a simple
way to do that. I cannot simply erase all the data because some data
needs to be in place for the application to even start.


More information about the Haskell-Cafe mailing list