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

payday loans online legit
[url=http://loansmart24.com/]best online loans instant approval [/url]
payday lender fees
loans online instant
best fast loans online

payday loans online legit
[url=http://loansmart24.com/]best online loans instant approval [/url]
payday lender fees
loans online instant
best fast loans online

trusted payday loans online
trusted payday loans online
best fast loans online
loans online instant
payday loans definition

speedy cash payday loans online
loan cash
payday loans las vegas
payday loans online legit
loan cash

speedy cash payday loans online
loan cash
payday loans las vegas
payday loans online legit
loan cash

speedy cash payday loans online
loan cash
payday loans las vegas
payday loans online legit
loan cash

online loans for bad credit
trusted payday loans online
loan cash
loans online no credit check
loans online no credit check

payday loans online bad credit
payday loans online no credit check
fast quick loans online
loans online instant
trusted payday loans online

payday loans online bad credit
payday loans online no credit check
fast quick loans online
loans online instant
trusted payday loans online

payday loans online bad credit
payday loans online no credit check
fast quick loans online
loans online instant
trusted payday loans online

casino slots
empire city online casino
empire city online casino
casino online
online casino games

casino slots
empire city online casino
empire city online casino
casino online
online casino games

best online casino
casino bonus
online casinos
online casino
free casino games online

best online casino
casino bonus
online casinos
online casino
free casino games online

best online casino
casino bonus
online casinos
online casino
free casino games online

casino slots
new online casinos accepting usa
free casino games online
new online casinos accepting usa
casino blackjack

casino slots
new online casinos accepting usa
free casino games online
new online casinos accepting usa
casino blackjack

online casino games
free online casino
list of casino slot machines
nj online casino
online casino real money

online casino games
free online casino
list of casino slot machines
nj online casino
online casino real money

online casino games
free online casino
online casino usa
online casino games
casino games online

online casino games
free online casino
online casino usa
online casino games
casino games online

online casino games
free online casino
online casino usa
online casino games
casino games online

free online casino
casino games online
online casino reviews
free casino games online
free online casino

free online casino
casino games online
online casino reviews
free casino games online
free online casino

free online casino
casino games online
online casino reviews
free casino games online
free online casino

free online casino
casino games online
online casino reviews
free casino games online
free online casino

list of casino slot machines
real online casino
casino games online
casino bonus
real online casino

list of casino slot machines
real online casino
casino games online
casino bonus
real online casino

yka online casino

loan cash
speedy cash payday loans online
loans online only
fast quick loans online
online loans direct lenders

loan cash
speedy cash payday loans online
loans online only
fast quick loans online
online loans direct lenders

payday loans definition
fast quick loans online
best fast loans online
best online loans instant approval
online loans direct lenders

payday loans bad credit
best fast loans online
best online loans instant approval
loans online no credit check
loan cash

wff casino online

wff casino online

casino slots
casino bonus
new online casinos accepting usa
casino bonus codes
online casinos

casino slots
casino bonus
new online casinos accepting usa
casino bonus codes
online casinos

new online casinos accepting usa
play casino
casino online
casino slots
free casino games slot machines

casino games
best online casino
real online casino
casino online
best online casino

play casino
online casino
new online casinos accepting usa
casino slots
free online casino slots

Pages