Created
December 1, 2015 17:36
-
-
Save gwax/0f3936b468b597e8d93f to your computer and use it in GitHub Desktop.
Comparing Schema dropping to DB dropping with testing.postgresql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import timeit | |
setup = """ | |
import testing.postgresql | |
import sqlalchemy | |
postgres = testing.postgresql.Postgresql() | |
engine = sqlalchemy.create_engine(postgres.url()) | |
conn = engine.connect() | |
conn.connection.connection.set_isolation_level(0) | |
""" | |
timed1 = """ | |
conn.execute('CREATE SCHEMA test_schema') | |
conn.execute('DROP SCHEMA test_schema CASCADE') | |
""" | |
timed2 = """ | |
conn.execute('CREATE DATABASE test_db') | |
conn.execute('DROP DATABASE test_db') | |
""" | |
timeit.timeit(setup=setup, stmt=timed1, number=100) | |
timeit.timeit(setup=setup, stmt=timed2, number=100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment