Skip to content

Commit a59832a

Browse files
rad-patclaude
andcommitted
Benchmark BCP under default (FULL) recovery; report active recovery model
Drop the ALTER DATABASE SET RECOVERY SIMPLE so BCP is measured under full logging, and print the active recovery model for interpretability. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 58cac46 commit a59832a

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

tests/sqlserver_test.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,17 +1489,19 @@ def test_performance(cursor: pyodbc.Cursor):
14891489
N_BULK = 100_000
14901490
BATCH = 20_000
14911491

1492-
# AUTOCOMMIT so BCP commits as it goes and ALTER DATABASE can run.
1492+
# AUTOCOMMIT so BCP commits as it goes.
14931493
cursor.connection.autocommit = True
14941494

1495-
# Minimal logging requires a non-FULL recovery model. Best-effort: ignore
1496-
# failures (e.g. insufficient permissions) so the benchmark still runs.
1495+
# NOTE: recovery model left at the database default (FULL on a fresh DB) to
1496+
# measure BCP under full logging. Report the active recovery model so the
1497+
# numbers are interpretable.
14971498
try:
1498-
dbname = cursor.execute("SELECT DB_NAME()").fetchval()
1499-
cursor.execute(f"ALTER DATABASE [{dbname}] SET RECOVERY SIMPLE")
1500-
print(f"recovery model set to SIMPLE for [{dbname}]")
1499+
rm = cursor.execute(
1500+
"SELECT recovery_model_desc FROM sys.databases WHERE database_id = DB_ID()"
1501+
).fetchval()
1502+
print(f"recovery model: {rm}")
15011503
except pyodbc.Error as e:
1502-
print(f"could not set SIMPLE recovery (continuing): {e}")
1504+
print(f"could not read recovery model (continuing): {e}")
15031505

15041506
cursor.execute("DROP TABLE IF EXISTS test_perf")
15051507
cursor.execute("""

0 commit comments

Comments
 (0)