Month: January 2016

SQL Server – Dangers of Delete

To minimise the risks that go with deleting data, I’m in the habit of writing out and testing the WHERE  clause in a separate query first. Couple that with an explicit BEGIN TRANSACTION / ROLLBACK / COMMIT  and your data should be pretty safe from unintentional deletions. A piece of buggy T-SQL code that was shared with me from a production Stored Procedure illustrated an…

pgSQL vs T-SQL – Database Shrinking to reclaim space for the OS

Databases typically grow over time. One occasion where they may counter that trend is if obsolete data is permanently removed. In Postgres, Dropping or Truncating a table does clear its data file on disk (see $PGDATA/base/YourDbOID/ ). However in SQL Server it doesn’t. Nor does running a regular VACUUM in Postgres following bloat introduced from Updates and Deletes. Internally, the…