SQL Server useful but less known features

  • Posted on: 2 November 2016
  • By: Michał Turecki
  1. Checking who is connected to the database

    sp_who

    SELECT
    NULL as [Connections by Database],
    [host_name] AS [Client Machine],
    db.name AS [Database],
    [program_name] AS [Client Program],
    COUNT(*) AS [Open Connections]
    FROM sys.dm_exec_sessions s (nolock)
    LEFT JOIN sys.dm_exec_requests r (nolock) ON r.session_id = s.session_id
    LEFT JOIN sys.databases db (nolock) ON db.database_id = r.database_id
    WHERE s.session_id >= 50 -- Ignore SQL Server processes
    GROUP BY [host_name], db.name, [program_name]
    ORDER BY [Client Machine], [Database], [Client Program]

  2. Adjusting connection pooling settings

    By default pool size is 100 per database with a command timeout (effectively a connection timeout) of 15 seconds. To increase add following to the connection string:

    Connection Timeout=30;Pooling='true';Max Pool Size=200

  3. Checking the size of column's contents

    To check how much data the column contains:

    SELECT *, DATALENGTH([column]) AS ColumnSizeInBytes FROM table

  4. Using SQL Server profiler

    Profiler is a powerful way to debug application performance problems, to check query execution time. If you're developing any application using SQL Server as a database, running it at least once for every application release can help with pinpointing possible performance issues. Remember the rule - there should be a constant number of queries regardless of the amount of records fetched - that way application will scale better. Sometimes it's better to replace a single complex query with more simpler queries because for each result row, columns shared by joins are repeated and delivered to client for processing many times.

Comments

loans for bad credit
pay day loans
payday loan
bad credit loans
payday loan
online loans
loans direct
payday loans direct lender
online payday loans

loans for bad credit
pay day loans
payday loan
bad credit loans
payday loan
online loans
loans direct
payday loans direct lender
online payday loans

online casino reviews
casino online
real online casino
best casino slots machine
free online casino
list of casino slot machines
nj online casino
nj online casino
best online casino
casino slots

online casino reviews
casino online
real online casino
best casino slots machine
free online casino
list of casino slot machines
nj online casino
nj online casino
best online casino
casino slots

online casino reviews
casino online
real online casino
best casino slots machine
free online casino
list of casino slot machines
nj online casino
nj online casino
best online casino
casino slots

personal loan
payday advance
cash loans
bad credit loans
loans with bad credit
loans bad credit
payday advance
cash loans
payday express

personal loan
payday advance
cash loans
bad credit loans
loans with bad credit
loans bad credit
payday advance
cash loans
payday express

personal loan
payday advance
cash loans
bad credit loans
loans with bad credit
loans bad credit
payday advance
cash loans
payday express

online casino no deposit bonus
online casino real money no deposit
online casino usa
online casino
online casino usa
free online casino
casino slots
online casino real money
best casino slots machine
nj online casino

online casino no deposit bonus
online casino real money no deposit
online casino usa
online casino
online casino usa
free online casino
casino slots
online casino real money
best casino slots machine
nj online casino

online casino no deposit bonus
online casino real money no deposit
online casino usa
online casino
online casino usa
free online casino
casino slots
online casino real money
best casino slots machine
nj online casino

personal loans for bad credit
pay day loans
loans with bad credit
loans with bad credit
bad credit loans
bad credit personal loans
loans for bad credit
personal loan
pay day loans

personal loans for bad credit
pay day loans
loans with bad credit
loans with bad credit
bad credit loans
bad credit personal loans
loans for bad credit
personal loan
pay day loans

personal loans for bad credit
pay day loans
loans with bad credit
loans with bad credit
bad credit loans
bad credit personal loans
loans for bad credit
personal loan
pay day loans

payday advance
loans online
loans direct
bad credit personal loans
loans bad credit
quick loans
loans online
unsecured loans
personal loan

best online casino
best casino slots machine
online casino usa
online casino no deposit bonus
empire city online casino
online casino usa
online casino no deposit bonus
list of casino slot machines
casino slots
best casino slots machine

payday advance
loans online
loans direct
bad credit personal loans
loans bad credit
quick loans
loans online
unsecured loans
personal loan

payday advance
loans online
loans direct
bad credit personal loans
loans bad credit
quick loans
loans online
unsecured loans
personal loan

payday advance
loans online
loans direct
bad credit personal loans
loans bad credit
quick loans
loans online
unsecured loans
personal loan

best online casino
best casino slots machine
online casino usa
online casino no deposit bonus
empire city online casino
online casino usa
online casino no deposit bonus
list of casino slot machines
casino slots
best casino slots machine

bad credit personal loans
unsecured loans
unsecured loans
personal loans
personal loans
bad credit loans
loans direct
loans for people with bad credit
unsecured loans

bad credit personal loans
unsecured loans
unsecured loans
personal loans
personal loans
bad credit loans
loans direct
loans for people with bad credit
unsecured loans

bad credit personal loans
unsecured loans
unsecured loans
personal loans
personal loans
bad credit loans
loans direct
loans for people with bad credit
unsecured loans

bad credit personal loans
unsecured loans
unsecured loans
personal loans
personal loans
bad credit loans
loans direct
loans for people with bad credit
unsecured loans

free online casino
free casino games online
casino slots
online casino usa
online casinos
online casino
casino online
empire city online casino
best casino slots machine
new online casinos accepting usa

Purchase Fluoxetine Discount Australia With Free Shipping Cheapest Levitra Online Cialis Da 10 generic cialis canada Buy Sertraline

Purchase Fluoxetine Discount Australia With Free Shipping Cheapest Levitra Online Cialis Da 10 generic cialis canada Buy Sertraline

Purchase Fluoxetine Discount Australia With Free Shipping Cheapest Levitra Online Cialis Da 10 generic cialis canada Buy Sertraline

cash advance
personal loans
loans bad credit
payday loans direct lender
unsecured loans
pay day loans
loans for people with bad credit
personal loans
payday advance

cash advance
personal loans
loans bad credit
payday loans direct lender
unsecured loans
pay day loans
loans for people with bad credit
personal loans
payday advance

cash advance
personal loans
loans bad credit
payday loans direct lender
unsecured loans
pay day loans
loans for people with bad credit
personal loans
payday advance

cash advance
personal loans
loans bad credit
payday loans direct lender
unsecured loans
pay day loans
loans for people with bad credit
personal loans
payday advance

best casino slots machine
casino blackjack
online casino reviews
real online casino
online casino games
list of casino slot machines
nj online casino
best casino slots machine
best casino slots machine
casino online

best casino slots machine
casino blackjack
online casino reviews
real online casino
online casino games
list of casino slot machines
nj online casino
best casino slots machine
best casino slots machine
casino online

Pages