Year: 2014

SQL Server or MySQL for our Business Needs?

Business Need: Currently we are in the cross-roads of growing from small-mid sized company to large scale K-12 online Test Delivery and reporting Solution provider. We primarily operate on K-12 Summative Market and its absolutely critical for us  to provide 100 % accuracy

SQL Server 2014 – Memory Optimized Tables

Our Team Need : We have about 5-500 GB Databases and very few tables ( ~ About 10 tables ) are high volume high concurrency tables. At peak volume, we may write few thousands per second per table. We are

XACT_ABORT Settings and Connection Timeout Nuances

We have .NET Application connecting to SQL Server database. I have noticed the timeout from the Application while calling the stored Procedure. We didn’t configure any specific timeout limit , so we were using default 30 Sec Timeout. Its pretty

SQL Handle to SQL Text

SQL Handle to SQL Text with Statement Start and Statement End: DECLARE @sql_handle VARBINARY(64) , @stmtstart INT , @stmtend INT SELECT @stmtstart = 3268 , @stmtend = 5102 , @sql_handle = 0x03000800d8c3dd70e2f83f01e2a300000100000000000000 SELECT SUBSTRING(qt.text, s.statement_start_offset / 2, ( CASE WHEN

Deadlocks : Count , Analysis and Event Notification

SQL Server : Number of Deadlocks since Last SQL Server Restart SELECT sqlserver_start_time AS ServerRestartTime FROM sys.dm_os_sys_info SELECT * FROM sys.dm_os_performance_counters WHERE counter_name = ‘Number of Deadlocks/sec’ AND instance_name = ‘_Total’ — Trace Flags to Capture Deadlock Events DBCC TRACESTATUS(1222)

SQL Server – Read Errorlog

Enable Audit log to capture successful and failed Logins — To Enable Failed and Successful Logins — Need to Restart the Server for this to effect EXEC xp_instance_regwrite N’HKEY_LOCAL_MACHINE’, N’Software\Microsoft\MSSQLServer\MSSQLServer’, N’AuditLevel’, REG_DWORD, 3; GO — Query for Successful Logins EXEC

Index Pointers

Indexes  – Pointers to Consider Max index size – 16 columns or 900 bytes whichever comes first Page Size – 8 KB – 8192 Bytes  Storage Available = 8192 Bytes – 96 Bytes for non-data storage = 8096 bytes /

SQL Server – Simple Best Practices

SQL Server – Simple Best Practices SET NOCOUNT ON SET NOCOUNT ON prevents the sending of DONE_IN_PROC messages to the client for each statement.This setting SET NOCOUNT to ON can provide a significant performance boost, because network traffic is greatly

Show Database Size and Last access time

How do you find the last time a database was accessed and size? We had about 108 databases on one of our Test Servers and it was being used by multiple teams and we don’t have comprehensive list of what’s

Backup and Restore TimeStamps

Database  Restore History How old is the Database if restored from the Backup file : In lab environment , we always get the copy of production database and restore it. Have you ever wondered how old is the database in lab

Database Mail check

Database Mail check to ensure it is operational: USE msdb GO SELECT * FROM sysmail_allitems GO SELECT * FROM sysmail_sentitems GO SELECT * FROM sysmail_unsentitems GO SELECT * FROM dbo.sysmail_faileditems GO SELECT * FROM dbo.sysmail_mailitems GO SELECT * FROM dbo.sysmail_log

Temporary Tables Vs Table Variables

Temporary Tables Vs Table Variables Table Variables : No Transaction Log Overhead No Lock Overhead No Recompilations No Rollback Maintenance You can only have one Primary Key or UNIQUE Constraint. You can have only one INDEX Usually it doesn’t trigger

Hike List in PNW Area

Hike List from Pacific Northwest Collection of photos from Hiking Trips in Pacific Northwest Area. I have done several hikes in Pacific northwest region. Hopefully this information would be helpful for someone who likes to explore and enjoy pristine pacific

Useful Links and URLS

Useful Links and URLS Cassandra Calender: Learn Ruby: Code Academy – Standford CS Courses: MIT Open Courseware:   Khan Academy:   Java JDK Path: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home David Malan Page: SQL Server: Nested Loops Explained

NGINX Protect Domain through Password

NGINX Protect Domain through Password It’s very easy to place a simple htpasswd-based authentication system on a domain served by nginx. To do this, you’ll want your server block to look like this: server { listen 80; server_name; root

NGINX and APACHE URL Redirects

NGINX APACHE URL Redirects Redirect all the requests to https server { listen 80; server_name; rewrite ^ https://$server_name$request_uri? permanent; } Redirect Specific Pages rewrite /humor /humor/humor.php; rewrite /events/search /Events/events_search.php; rewrite /events/summary /Events/events_summary.php; rewrite /photos /photos/index.php; rewrite /help /Technology/blog.php?ID=344; rewrite

Change HostName in Linux Machines

Change HostName in Linux Machines Edit  /etc/hostname , make the name change, save the file. You should also make the same changes in /etc/hosts  file Run sudo /etc/init.d/hostname restart or sudo service hostname restart /etc/hostname /etc/hosts sudo /etc/init.d/hostname restart sudo

Backup-Zip-Copy-Unzip-Restore-Notify SQL Server Databases

Backup-Zip-Copy-Unzip-Restore SQL Server Databases: I am sure we all try to bring databases from One Environment to Another Environment whether its to accomplish testing, debugging or maintaining the parity between production and lab. I used to spend little bit of time

SQL Server : Find SQL Server TCP Port and IP Address

SQL Server : Find SQL Server TCP Port and IP Address SELECT @@SERVERNAME AS ServerName , local_tcp_port,local_net_address FROM sys.dm_exec_connections WHERE session_id = @@SPID Results : ServerName local_tcp_port local_net_address DEVENV\2008R2 59663

SQL Server – Create and Parse Comma Seperated List

XML Approach: Reads : 2 Duration:5 ms Substring Approach: Reads : 16 Duration: 14 ms –declare a variable and populate it with a comma separated string DECLARE @SQLString VARCHAR(MAX) SET @SQLString = N’94, 95, 96, 97, 98, 99, 100, 101,