Your Database Is an API: Treating the Schema as a Versioned Contract
A developer renames a column. The rename is clean, the build is green, the unit tests pass, and the pull request merges on a Tuesday afternoon. On Thursday a finance report that nobody on the…
Performance Counters Over Time: Making sys.dm_os_performance_counters Tell the Truth
Run this query on any SQL Server and look at the number it gives you for Batch Requests/sec:
|
1 2 3 4 5 6 7 |
SELECT [counter_name] , [cntr_value] FROM [sys].[dm_os_performance_counters] WHERE [counter_name] = N'Batch Requests/sec'; |
On a server that has been up for a few weeks you will get something like…
I Called Myself Dumb in a Code Comment. I Was Wrong About the Cursor.
I went looking through an old reconciliation script this week, the kind you write once for a quarter-end reconciliation and forget about, and I found a note from my past self. Right above a cursor,…
Seeing Exactly Where SQL Server Stores Each Column
You add a couple of varchar(max) columns to a table because you are not sure how big the values will get. Most rows hold a few dozen characters. A handful hold tens of thousands. Everything…
Self-Contained Transaction Scripts in SQL Server: the @debug_only Pattern
A safer alternative to the commented-out COMMIT habit: a @debug_only flag, SET XACT_ABORT ON, a named transaction, and an XACT_STATE guard that never leaves a transaction open.
COMMIT, ROLLBACK, and Autocommit: PostgreSQL Transactions for SQL Server DBAs
SQL Server DBAs lean on the ‘run to the SELECT, then COMMIT or ROLLBACK by hand’ workflow. PostgreSQL’s autocommit, abort-on-error, and plpgsql change the rules. Here is how to get the same safety and diagnostics in psql and pgAdmin.