I guess I got ahead of myself. I got the vacuum full analyze working. The one scenario I’ve been testing with ran fast each time. So I put it in the tearDownClass method in our TestCase class, thinking I could broadly apply it across all the test classes and address all of the slow tests:
@classmethod
def tearDownClass(cls):
print("Clearing out postgres statistics tables")
conn = psycopg2.connect()
conn.autocommit = True
with conn.cursor() as cursor:
cursor.execute("VACUUM FULL ANALYZE")
conn.close()
super().setUpClass()
but I ended up with a slew of errors ranging from a bunch of assertion failures to a bunch of exceptions.
I’m going to have to come back to this tomorrow. I have to sort all this out.