June 12, 2020

What are differences between Always ON and SQL Server Clustering?

Always On is a commercial name for a set of High Availability features that include Fail-over Cluster Instances and Availability Groups.
The main difference is that a clustered instance has the same binaries installed and configured on two or mode cluster nodes (physical or virtual machines) and the database files are sitting on a shared disk. Only one node at a time can own the data disks and run the SQL Server instance (active node) and all other nodes are said to be passive. When the node fails for any reason, the disks are moved to one of the passive nodes and the service is started, making it the active node. All clients connecting to the clustered instance use its virtual network name, which is moved to the active node, ensuring that all clients are able to connect to the active node.
With Availability Groups, two or more copies of the same database are synchronized across multiple nodes. In this case you don't have a single copy of the database files, but you have multiple copies (replicas). One of those copies is read/write, while all other copies are read-only. To ensure that the clients are connecting to the appropriate replica, a virtual network name (listener) is used, which is similar to what the cluster virtual network name does. With an additional connection string property, you can control whether you're hitting the read/write or read-only replica

January 8, 2020

What is SaaS, IaaS & PaaS?

The cloud is a hot topic for small businesses all the way to global enterprises, but remains a broad concept that covers a lot of online territory. There are usually three models of cloud service to compare: Software as a Service (SaaS), Platform as a Service (PaaS), and Infrastructure as a Service (IaaS). Each of these has its own benefits, as well as variances, and it is necessary to understand the differences among SaaS, PaaS, and IaaS to know how to best choose one for your organization.
  • SaaS: Software as a Service
Software as a Service, also known as cloud application services, represents the most commonly utilized option for businesses in the cloud market. SaaS utilizes the internet to deliver applications, which are managed by a third-party vendor, to its users. A majority of SaaS applications run directly through your web browser, which means they do not require any downloads or installations on the client side.
SaaS Characteristics :
There are a few ways to help you determine when SaaS is being utilized:
·     Managed from a central location
·     Hosted on a remote server
·     Accessible over the internet
·     Users not responsible for hardware or software updates

November 20, 2019

Postgresql Basic Commands


Postgresql Basic Commands

Login to postgresql:
psql -d mydb -U myuser -W
psql -h myhost -d mydb -U myuser -W
psql -U myuser -h myhost "dbname=mydb sslmode=require" 
# ssl connection

Default Admin Login:
sudo -u postgres psql -U postgres
sudo -u postgres psql

List databases on postgresql server:
psql -l [-U myuser] [-W]

Turn off line pager pagination in psql:
\pset pager

Determine system tables:
select * from pg_tables where tableowner = 'postgres';

List databases from within a pg shell:
\l

List databases from UNIX command prompt:
psql -U postgres -l

Describe a table:
\d tablename

Quit psql:
\q

May 21, 2019

To find SQL Version,Edition & Instance Name in SQL 2008,2012,2014,etc

The below query will give the SQL Product Full Specification details.

SELECT  
    SERVERPROPERTY('productversion') as 'Product Version', 
    SERVERPROPERTY('productlevel') as 'Product Level',  
    SERVERPROPERTY('edition') as 'Product Edition',
    SERVERPROPERTY('buildclrversion') as 'CLR Version',
    SERVERPROPERTY('collation') as 'Default Collation',
    SERVERPROPERTY('instancename') as 'Instance',
    SERVERPROPERTY('lcid') as 'LCID',
    SERVERPROPERTY('servername') as 'Server Name'

April 22, 2019

How to find Indexes on a Table In SQL Server

Using system stored procedure sp_helpindex, system catalog views like sys.indexes or sys.index_columns methods. 

1. Find Indexes On A Table Using SP_HELPINDEX

sp_helpindex is a system stored procedure which lists the information of all the indexes on a table or view. This is the easiest method to find the indexes in a table. sp_helpindex returns the name of the index, description of the index and the name of the column on which the index was created.

EXEC sp_helpindex '[[[SCHEMA-NAME.TABLE-NAME]]]'
GO

March 20, 2019

Missing Index Script in SQL Server Database 2016

Performance Tuning is quite interesting and Index plays a vital role in it. A proper index can improve the performance and a bad index can hamper the performance. In this blog post we will discuss about Missing Index. Here is the script from my script bank, which I use to identify missing indexes on any database.

March 6, 2019

Last Used Database in SQL Server

In SQL Server 2005, can you easily determine the last time someone queried a database.

SELECT d.name,
last_user_seek = MAX(last_user_seek),
last_user_scan = MAX(last_user_scan),
last_user_lookup = MAX(last_user_lookup),
last_user_update = MAX(last_user_update)
FROM sys.dm_db_index_usage_stats AS i
JOIN sys.databases AS d ON i.database_id=d.database_id

GROUP BY d.name