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

Hi there! purchase cialis where buy cialis buy finasteride pills very good website

Hi there! purchase cialis where buy cialis buy finasteride pills very good website

Hi there! cialis cheap buy tadalafil no prescription buy finasteride online excellent website

Hi there! cialis cheap buy tadalafil no prescription buy finasteride online excellent website

Hi there! cialis cheap buy tadalafil no prescription buy finasteride online excellent website

Hi there! cialis cheap buy tadalafil no prescription buy finasteride online excellent website

Hello! tadalafil buy cialis medication purchase propecia online no prescription excellent internet site

Hello! tadalafil buy cialis medication purchase propecia online no prescription excellent internet site

Hello! tadalafil buy cialis medication purchase propecia online no prescription excellent internet site

Hello! tadalafil buy cialis medication purchase propecia online no prescription excellent internet site

Hello there! buy generic cialis buy cialis no prescription buy finasteride pills very good web site

Hello there! buy generic cialis buy cialis no prescription buy finasteride pills very good web site

Hello there! buy generic cialis buy cialis no prescription buy finasteride pills very good web site

Hi there! purchase tadalafil tadalafil buy generic propecia great site

Hi there! purchase tadalafil tadalafil buy generic propecia great site

Howdy! purchase cialis order tadalafil propecia good site

Howdy! purchase cialis order tadalafil propecia good site

Hi! buy cialis cheap order cialis buy propecia medication great website

Hello there! buy generic cialis buy cialis no rx buy propecia cheap excellent web site

Hello there! buy generic cialis buy cialis no rx buy propecia cheap excellent web site

Hello there! buy generic cialis buy cialis no rx buy propecia cheap excellent web site

best online casino
free casino games online
casino movie online
free online casino
free online casino slots

best online casino
free casino games online
casino movie online
free online casino
free online casino slots

best online casino
free casino games online
casino movie online
free online casino
free online casino slots

casino online
online casino
free casino games online
online casino real money no deposit
free casino games online

casino online gambling
pogo casino slots
casino games slots
casino games free online
top rated free online casino games

casino online gambling
pogo casino slots
casino games slots
casino games free online
top rated free online casino games

casino online gambling
pogo casino slots
casino games slots
casino games free online
top rated free online casino games

pogo casino slots
casino online
new usa online casinos 2017
new usa online casinos 2017
casino online application

play casino games online
top rated free online casino games
pogo casino slots
casino online application
vegas casino games

play casino games online
top rated free online casino games
pogo casino slots
casino online application
vegas casino games

casino online free
casino online subtitrat
pogo casino slots
casino online usa
online casino real money

casino online free
casino online subtitrat
pogo casino slots
casino online usa
online casino real money

casino online free
casino online subtitrat
pogo casino slots
casino online usa
online casino real money

casino online for fun
casino games real money
casino games free online
casino games real money
casino games free

top rated free online casino games
casino games free online
casino online application
casino online usa
new usa online casinos

casino games free
online casinos 2016
casino online for fun
casino games roulette
casino online free

casino games free
online casinos 2016
casino online for fun
casino games roulette
casino online free

casino games free
online casinos 2016
casino online for fun
casino games roulette
casino online free

casino games free
online casinos 2016
casino online for fun
casino games roulette
casino online free

Hi there! order tadalafil buy valtrex 500 mg rx cost excellent web site

Hi there! buy cialis pills buy valtrex pills online prescription without a doctor's prescription beneficial web site

Hi there! buy cialis pills buy valtrex pills online prescription without a doctor's prescription beneficial web site

best online casino
free online casino
free online casino
online casino real money
online casino real money

Hi there! buy cialis pills buy valtrex pills online prescription without a doctor's prescription beneficial web site

Hello there! buy cialis with no prescription purchase valtrex online no prescription drug pricing very good site

Hello there! buy cialis with no prescription purchase valtrex online no prescription drug pricing very good site

Hello there! buy cialis with no prescription purchase valtrex online no prescription drug pricing very good site

Hello there! buy cialis with no prescription purchase valtrex online no prescription drug pricing very good site

watch casino online free
free casino games online
real online casino
online casino usa
watch casino online

Pages