简体   繁体   中英

What does “number of databases” in Azure imply?

In the Azure pricing calculator you can configure the number of databases. The costs for Azure SQL storage scale quite linear with the number of databases.

What's not clear for me, is what is counted when they mention the number of databases?

  • The number of connection strings I define in my solution?
  • The actual number of databases I create in the database that corresponds to one connection string ?

In terms of an example: I have a multitenant web application. I create a new database for every tenant, but store the database in the database I refer to via 1 connections string.

public class ApplicationContext : DbContext, IDbContext
{
    public DbSet<Tenant> Tenants { get; set; }
    public DbSet<User> Users { get; set; }

    public ApplicationContext(string tenantName) : base(tenantName)
    {
    }

    public new IDbSet<TEntity> Set<TEntity>() where TEntity : class
    {
        return base.Set<TEntity>();
    }
} 

I publish my webapp with the following configuration to my Azure database:

Server=tcp:gd5ydgrwa0.database.windows.net,1433;Database=xxx;User ID=xxx;Password=xxx;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;

I can't find this anywhere in their documentation. Help is very much appreciated. If Azure charges us a database per tenant we need to reconsider our database design.

If I have 10 customers, I will have 10 databases. Will Azure charge me for 10 databases? Or just for the 1 I configured?

1 database

在此输入图像描述

10 databases 在此输入图像描述

It referees to the number of databases, as in your connectionstring: Database=xxx.

if all your tenant's "databases" is stored in xxx, you will be charged for for 1 database. But if you alter the connecting string so that you use xxx1, xxx2, ..., xxxN, you will be charged for N databases.

When you write "The actual number of databases I create in the database that corresponds to one connection string?", you seem to refer to the number of separate/ named schemas in a single database. This is the 'Shared database, separate schemas' pattern discussed in http://msdn.microsoft.com/en-us/library/aa479086.aspx . You are only charged for the number of actual databases you use, not the number of separate schemas within the database. Of course you could create a database of the same name in multiple servers, and then you would pay for each database in each server. As randoms points out, each Azure database has its own connection string specifying the server and database it connects to so each connection string corresponds to a database for which there is a separate charge.

It does not directly relate to the number of connection strings because you can have many connection strings that all point to the same Database and Server with different options.

So one SQL Azure database e If you pull the Server and Database attributes from all your connection strings You could count them as the distinct number of Server and Database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM