Azure Single Database vs Elastic Pool Databases - sql

I have created an azure SQL single database "w3s_singledb" with no elastic pool and SQL server named "singledb2022dec". After logging into "singledb2022dec.database.windows.net" I executed "create database w3s_seconddb" and it was created.
Next, I created Azure Elastic Pool "elasticpool2022dec" and SQL server named "elasticpool2022dec.database.windows.net". After logging into "elasticpool2022dec.database.windows.net" I executed "create database testdb1" and "create database testdb2". Both were created.
I changed all the databases pricing to basic DTU.
I was trying to understand the basic difference between Single Database and Elastic Pool Databases.?
I know Single Database will be used for "When Application needs a Single Database to work on".
And Elastic Pool will be used for "When Application needs multiple databases to work on and need to share Common Resources like CPU and RAM".
I was trying to understand more elaborately.

The basic idea with an Elastic pool is that you can share resources among databases that need resources at different times. Thereby avoiding paying for idle resources.
Example:
3 databases, set up as 3 single database instance, costs 3X
3 databases, set up as an elastic pool with total resources comparable to 2 single databases, costs 2X

Azure SQL databases are throttled, once you’ve reached the limit of the database resources, additional requests will be timed out.
With an elastic pool, you create a shared resource group for your databases. This can be much more cost efficient, especially when your database infrastructure requires multiple databases or multi-tenancy.
If your database resource usage displays a typical pattern with peaks in performance every now and then, an Elastic Pool might be suited for you.
If your database usage requires large amounts of resources for a longer period of time, it might be a better idea to have a dedicated resource tier for your database.
If you want to change the service tier or compute size of an Elastic Pool, keep in mind that all databases within the pool are affected, briefly. But there will certainly be some kind of downtime during the scaling process. If you need to scale out a dedicated database tier, only that database is affected.

Related

Where is data physically stored in Azure Synapse Dedicated SQL Pool?

Documentation from Microsoft and others strongly emphasizes the separation between storage and compute in Azure Synapse Analytics.
In the case of a Serverless SQL pool, it is clearly explained that the data is stored in an Azure Data Lake DSL Gen2.
However, in the case of a Dedicated SQL Pool, the documentation is not explicit enough on data storage.
In a book that deals with Azure Synapse, it is stated that in the case of Dedicated SQL Pool, data is stored in Storage Nodes which are completely separate from Compute Nodes.
Since this claim is not in Microsoft's documentation, I dare not trust it.
So, is there an official resource that sheds light on this question?
This is a question that has been on my mind for a long time as well. However, I have come to the conclusion that data is actually stored in Dedicated SQL Pools.
Let me explain why I believe this.
Take a look at the documentation given here,
https://learn.microsoft.com/en-us/azure/synapse-analytics/quickstart-copy-activity-load-sql-pool
Notice that it is about loading data into a Dedicated SQL Pool. Further, to quote part of the documentation,
A dedicated SQL pool offers T-SQL based compute and storage
capabilities. After creating a dedicated SQL pool in your Synapse
workspace, data can be loaded, modeled, processed, and delivered for
faster analytic insight.
It is said that Dedicated SQL Pools provide both compute and storage capabilities.
Furthermore, with Dedicated SQL Pools, you may already know that it is possible to create traditional tables. We can organize these tables into something along the lines of a star or snowflake schema to model our data warehouses.
Creation of such tables, however, is not possible with Serverless SQL Pools. Only the creation of metadata objects, i.e. views or external tables are allowed. This is explained here,
https://learn.microsoft.com/en-us/azure/synapse-analytics/sql/on-demand-workspace-overview
To quote the relevant passage of the article,
Serverless SQL pool has no local storage, only metadata objects are
stored in databases. Therefore, T-SQL related to the following
concepts isn't supported:
Tables Triggers Materialized views DDL statements other than ones
related to views and security DML statements
To me, the fact that tables can actually be created in Dedicated SQL Pools is further proof that the data is physically stored in them.
My final argument is around the idea of distributions. The concept is explained here,
https://learn.microsoft.com/en-us/azure/synapse-analytics/sql-data-warehouse/massively-parallel-processing-mpp-architecture
This talks about how data is divided up among the compute nodes and how queries are executed in parallel on the distributions in these nodes. It would not be possible to implement this if the data was not actually stored in these nodes.
In my humble opinion, how I believe Azure Storage comes into the picture (at least, when it comes to Dedicated SQL Pools) is with regards to storing data as files in a data lake and then ingesting them into the pool for analysis.
An explanation can be found here,
https://learn.microsoft.com/en-us/azure/synapse-analytics/sql/overview-architecture
Yet another quote,
Serverless SQL pool allows you to query your data lake files, while
dedicated SQL pool allows you to query and ingest data from your data
lake files. When data is ingested into dedicated SQL pool, the data is
sharded into distributions to optimize the performance of the system.
This is where Polybase comes into play. You can define various data loading patterns (into Dedicated SQL Pools) using Polybase as explained here,
https://learn.microsoft.com/en-us/azure/synapse-analytics/sql/load-data-overview
The Microsoft documentation on Design tables using dedicated SQL pool in Azure Synapse Analytics, found at https://learn.microsoft.com/en-us/azure/synapse-analytics/sql-data-warehouse/sql-data-warehouse-tables-overview, states the following:
Table persistence: Tables store data either permanently in Azure
Storage, temporarily in Azure Storage, or in a data store external to
dedicated SQL pool.
Regular table A regular table stores data in Azure Storage as part of
dedicated SQL pool...

Azure Elastic Pool with Azure SQL Databases and MySQL databases

Fast question:
Is it possible to have an Elastic Pool in Azure with Azure SQL Databases and MySQL databases?
Or in alternative an Elastic Pool made of Managed Instance and MySQL databases?
Thank you #Francesco Mantovani. For now Lets post the answer that we have for now. Once you have your article ready, you can still post it as additional answer here.
===
Cut from https://dba.stackexchange.com/questions/279553/azure-elastic-pool-is-it-supported-for-mysql
Azure DB for MySQL is similar as Azure SQL DB Elastic pool or Azure SQL DB managed instance.
With Azure DB for MySQL server, we can create one or multiple DBs. We
can >
Create a single DB per server to use all the resources or
Create multiple databases to share the resources. The pricing is structured per-server, based on the configuration of pricing tier,
vCores, and storage (GB).
Reference : https://learn.microsoft.com/en-us/azure/mysql/concepts-servers
Similarly in Azure SQL DB Elastic Pool
Azure SQL DB elastic pools are cost-effective solution for managing
and scaling multiple databases that have varying and unpredictable
usage demands. The DBs in an elastic pool are on a single server and
share a set number of resources at a set price. Elastic pools in Azure
SQL DB enable SaaS developers to optimize the price performance for a
group of databases within a prescribed budget while delivering
performance elasticity for each database.
Reference : https://learn.microsoft.com/en-us/azure/azure-sql/database/elastic-pool-overview
Only Azure SQL DB has the feature to have multiple databases with separate physical resources in the same logical server.
In Azure DBs for MySQL, If you wish to have two DBs with their own dedicated resources, you need to have two separate Azure DBs for MySQL Servers.
I totally agree with MadhurajVadde-MT:
In Azure DBs for MySQL, If you wish to have two DBs with their own
dedicated resources, you need to have two separate Azure DBs for MySQL
Servers.
It might sound ridiculous but all Azure OSS servers are made to store several databases by default:
https://www.jeeja.biz/2021/08/26/lets-get-confused-azure-database-for-mysql-mariadb-postgresql-part-2/
You kinda have Elastic Pool by default.

If I remove databases from Azure elastic pool will I need to update SQL queries in the codebase?

I am currently using Microsoft Azures elastic pool to allocate resources to my databases as needed, however for my purposes at the moment the cost is too high for the amount of traffic the databases are handling. My question is if I removed the databases from the elastic pool and delete it will I need to update the SQL queries in my codebase?
I would not expect you would need to change any query. Elastic pools are meant to be for managing the pool of resource to distribute among the databases as and when needed. Moving the database in the pool as well as out is supported which does not indicate any need to update the application (or query).
I would suggest move a database out from the pool and test few queries to rule out any 'What If' in the mind

Azure SQL Database pricing is per database server or per user-created database

For Azure SQL Database pricing, the pricing is mentioned as $x/hour
Question: Let's say that 'x' is $2/hour. If I create 10 different user databases for my application, will I pay 10 times the hourly cost i.e. $20/hour or will I pay just $2/hour since the cost is for a database server?
I am not sure if I will be charged for each user-created database i.e. each of these 10 databases or just for one database server.
You will be charged for each user-created database i.e. each of these 10 databases depending of their pricing tier.
http://azure.microsoft.com/en-us/pricing/details/sql-database/
A new service plan was announced 04/2015, called SQL Azure Elastic database pool. As of today, it is still in preview mode, but pricing is available here -- make sure you click on Elastic Database button to see the prices.
With Elastic database pool the pricing model is as follows. First, you pay per pool, based on number of performance units you reserve for the pool (DTUs). Then you pay additionally for each database, which is part of the pool. The per-database price is quite small (currently around $1.26/mo), so most of your expenses will be a payments for DTUs, that are shared across all databases of your pool.
UPDATE:
As of May 2016, Azure SQL Database elastic pool is generally available. The pricing details are also updated. As of today, you can get up to 200 databases in Basic Tier for $149/month, which boils down to $0.745 per month per database.
The pricing for Azure SQL Database is per database. This means you would be paying for each of the 10 databases. You can learn more about Azure SQL Database pricing here.

SQL Mirroring or Failover Clustering VS Azure built in infrastructure

I read in a few places that SQL Azure data is automatically replicated and the Azure platform provides redundant copies of the data, Therefore SQL Server high availability features such as database mirroring and failover cluster aren't needed.
Has anyone got a chance to investigate deeper into this? Are all those availability enhancements really not needed in Azure? Thanks!
To clarify, I'm talking about SQL as a service and not a VM hosted SQL.
The SQL Database service (database-as-a-service) is a multi-tenant database service, and your databases are triple-replicated within the data center, providing durable storage. The service itself, being large-scale, provides high availability (since there are many VMs running the service itself, along with replicated data). Nothing is needed in terms of mirroring or failover clusters. Having said that: If, say, your particular database became unavailable for a period of time, you'll need to consider how you'll handle that situation (perhaps sync'ing to another SQL Database, maybe even in another data center).
If you go with SQL Database (DBaaS), you'll still need to work out your backup strategy, and possibly syncing with another DC (or on-premises database server) for DR purposes.
More info on SQL Database fault tolerance is here.
Your desired detail is probably contained in this MSDN article of Business Continuity and Azure SQL Database (see: http://msdn.microsoft.com/en-us/library/windowsazure/hh852669.aspx). At the most basic level Azure SQL Database will keep three replicas of your database - one primary and two secondary.
While this helps with BCP / DR scenarios you may also wish to investigate ways to backup your database so you have point-in-time restore capabilities. More information on backup / restore can be found here: http://msdn.microsoft.com/en-us/library/windowsazure/jj650016.aspx