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

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

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

online casino games
best online casino
casino online
play casino
free casino games slot machines

online casino
bovada casino
new online casinos accepting usa
borgata online casino
play slots for real money united states

list of casino slot machines
real casino play for free
online casino no deposit bonus
casino game
casino online slots

online casino
casino slots
borgata online casino
real casino play for free
online casino games

http://drugstorepharmacyxerh.com/ - online canadian pharmacy generic viagra reviews walmart pharmacy online

online casino
casino games
online casino games
best online casinos
casino online

online casino
casino games
online casino games
best online casinos
casino online

best online casino
casino slots
casino online
online casino
best online casinos

online casino games
casino bonus codes
casino games
casino games
best casino slots machine

new online casinos accepting usa
list of casino slot machines
casino slots
best online casino
casino bonus codes
real online casino
borgata online casino
free online casino
online casino

new online casinos accepting usa
list of casino slot machines
casino slots
best online casino
casino bonus codes
real online casino
borgata online casino
free online casino
online casino

online casinos
casino online
real casino play for free
casino bonus
online casino real money
play slots for real money united states
free casino games slot machines
best online casinos
casino online

casino games
real online casino
online casino no deposit bonus
casino games
online casino games
empire city online casino
free online casino slots
play casino
casino game

casino games
real online casino
online casino no deposit bonus
casino games
online casino games
empire city online casino
free online casino slots
play casino
casino game

best online casino
free online casino
best online casinos
free online casino
borgata online casino
casino slots
casino slots
casino games
online casino

best online casino
free online casino
best online casinos
free online casino
borgata online casino
casino slots
casino slots
casino games
online casino

casino games
real casino play for free
casino blackjack
free online casino slots
play casino
casino games
casino online slots
borgata online casino
casino games

casino slots
real casino play for free
free online casino slots
online casino
new online casinos accepting usa
play slots for real money united states
online casino
casino online
casino slots

play slots for real money united states
free online casino slots
online casino
play slots for real money united states
online casino no deposit bonus
casino online
casino slots
free online casino
casino game

play slots for real money united states
free online casino slots
online casino
play slots for real money united states
online casino no deposit bonus
casino online
casino slots
free online casino
casino game

play slots for real money united states
free online casino slots
online casino
play slots for real money united states
online casino no deposit bonus
casino online
casino slots
free online casino
casino game

play casino
free casino games slot machines
casino games
empire city online casino
online casino
online casino games
casino bonus codes
casino bonus
casino slots

new online casinos accepting usa
casino game
casino bonus codes
best online casino
casino blackjack
free online casino slots
real casino play for free
casino online
casino games

new online casinos accepting usa
casino game
casino bonus codes
best online casino
casino blackjack
free online casino slots
real casino play for free
casino online
casino games

new online casinos accepting usa
casino game
casino bonus codes
best online casino
casino blackjack
free online casino slots
real casino play for free
casino online
casino games

Pages