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

real online casino
casino games online
best casino slots machine
nj online casino
casino blackjack
new online casinos accepting usa
online casino real money no deposit
online casino games
real online casino
real online casino

real online casino
casino games online
best casino slots machine
nj online casino
casino blackjack
new online casinos accepting usa
online casino real money no deposit
online casino games
real online casino
real online casino

real online casino
casino games online
best casino slots machine
nj online casino
casino blackjack
new online casinos accepting usa
online casino real money no deposit
online casino games
real online casino
real online casino

online loans
bad credit loans
pay day loans
bad credit loans
loans online
payday loans direct lender
unsecured loans
short term loans
pay day loans

online loans
bad credit loans
pay day loans
bad credit loans
loans online
payday loans direct lender
unsecured loans
short term loans
pay day loans

payday loans online
loans direct
cash loans
loans online
personal loans
personal loans for bad credit
loans for people with bad credit
personal loans
loans for bad credit

payday loans online
loans direct
cash loans
loans online
personal loans
personal loans for bad credit
loans for people with bad credit
personal loans
loans for bad credit

payday loans online
loans direct
cash loans
loans online
personal loans
personal loans for bad credit
loans for people with bad credit
personal loans
loans for bad credit

payday loans online
loans bad credit
quick loans
pay day loans
unsecured loans
cash advance
payday loans
payday loans online
payday loans online

payday loans online
loans bad credit
quick loans
pay day loans
unsecured loans
cash advance
payday loans
payday loans online
payday loans online

cash advance
quick loans
payday loans direct lender
unsecured loans
cash advance
payday loans online
online loans
loans direct
loans with bad credit

loans online
loans online
loans online
loans direct
loans direct
short term loans
online loans
quick loans
payday advance

loans online
loans online
loans online
loans direct
loans direct
short term loans
online loans
quick loans
payday advance

personal loans for bad credit
loans bad credit
loans for bad credit
bad credit loans
cash loans
loans with bad credit
loans online
payday loan
pay day loans

personal loans for bad credit
loans bad credit
loans for bad credit
bad credit loans
cash loans
loans with bad credit
loans online
payday loan
pay day loans

personal loans for bad credit
loans bad credit
loans for bad credit
bad credit loans
cash loans
loans with bad credit
loans online
payday loan
pay day loans

personal loans for bad credit
loans bad credit
loans for bad credit
bad credit loans
cash loans
loans with bad credit
loans online
payday loan
pay day loans

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

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

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

loans with bad credit
cash loans
loans direct
personal loans for bad credit
loans bad credit
cash loans
payday advance
payday express
quick loans

loans with bad credit
cash loans
loans direct
personal loans for bad credit
loans bad credit
cash loans
payday advance
payday express
quick loans

loans with bad credit
cash loans
loans direct
personal loans for bad credit
loans bad credit
cash loans
payday advance
payday express
quick loans

loans with bad credit
cash loans
loans direct
personal loans for bad credit
loans bad credit
cash loans
payday advance
payday express
quick loans

Howdy! free cialis trial excellent web page.

Howdy! free cialis trial excellent web page.

Howdy! free cialis trial excellent web page.

Howdy! free cialis trial excellent web page.

Pages