Skip to content

SQL Server, PostgreSQL and MySQL

DBA: Database Administration and Performance

I keep databases fast and reliable as they grow: slow queries, missing indexes, backup routines and large databases with many people using them at once. I like to dig down to the last byte to understand why something is slow. My main focus is SQL Server, and I also work with PostgreSQL, MySQL and MariaDB.

Main tools

  • SQL Server
  • PostgreSQL
  • MySQL
  • MariaDB
  • SQLite
  • T-SQL

Real case

Bulk update

A process that updated a database of more than 100 thousand records and 50 columns took about 30 minutes. After the optimization, the same process ran in 12 to 30 seconds.

Before

~30 min

After

12–30 s

What I do

Slow query optimization

Most slowness comes from a handful of queries. I find them by accumulated cost, read the execution plan and go after the cause: full table reads, wrong row estimates, parameter sniffing or implicit type conversions. Always measuring before and after.

SQL Server indexes and execution plans

Too many indexes slow down writes; too few slow down reads. I review indexes with DMVs, drop the unused ones, add the ones missing for the heaviest queries and read execution plans looking for expensive key lookups, unnecessary scans and tempdb spills.

T-SQL, concurrency and deadlocks

I write and review procedures, functions and scripts, preferring set-based operations to row-by-row cursors. On databases with many simultaneous connections, I investigate blocking and deadlocks and tune access order, transaction size and isolation levels.

Backup, restore and maintenance

I set up backup routines with tested restores, index and statistics maintenance, integrity checks and file growth monitoring. I work with SQL Server 2016 up to the current versions.

Tools

What I use to diagnose and maintain databases:

  • SQL Server
  • PostgreSQL
  • MySQL
  • MariaDB
  • SQLite
  • T-SQL
  • SSMS
  • Execution plans
  • DMVs
  • Query Store
  • Extended Events
  • DBeaver

How a performance engagement works

  1. 1

    Access and data collection

    With read access, I collect the most expensive queries, the instance waits and the state of the indexes.

  2. 2

    Diagnosis

    I deliver a prioritized list of what is causing the slowness, with the reason for each item and the expected gain.

  3. 3

    Fixes

    I apply or guide the fixes in staging first, measuring before and after each one.

  4. 4

    Routine and follow-up

    I leave maintenance configured and documented so the database does not drift back to the same state.

  • Fully remote
  • Payment via Pix, card or PayPal

Database FAQ

A query suddenly got slow. What could it be?

The usual suspects are stale statistics, a bad plan cached through parameter sniffing, a table that grew or another transaction holding a lock. The actual execution plan usually tells you which one it is.

Will adding more indexes fix it?

Not always. Each index speeds up some reads, but slows down inserts and updates and takes up space. The goal is to have the indexes the important queries use and drop the ones nobody reads.

How do you deal with deadlocks?

I capture the deadlock graph to see which queries fought over which resources and fix the cause: table access order, a transaction that runs too long, a missing index or an unsuitable isolation level.

Do you need full access to the server?

For the diagnosis, read access to DMVs and execution plans is usually enough. Any change goes through staging first and is agreed with you before it reaches production.

Do you only work with SQL Server?

No. SQL Server is where I have the most mileage, but I also work with PostgreSQL, MySQL, MariaDB and SQLite. The reasoning about indexes and execution plans is similar across them.

Is your database slow?

Tell me what is slow, which database and version you use and the approximate size of the data. I will reply with the first questions and how I would start.

contato@jdaltonlins.dev