I am setting up a schema/some tables in SQL Azure and wanted to know if there were any things i need to do architecturally in order to promote scalability, especially horizontal scalability. Should IDs be of a certain type? Primary keys be of a certain type?
I am looking to avoid risk/issues down the road... let me know.
Thanks,
I would suggest you to please read the article Scale Out with SQL Database (en-US) which explains ins details about what is needed for Horizontal Partitioning of your SQL Database.
Now you can also use SQL Federation with SQL Database so another article on Scaling Out with SQL Azure Federation will help you to decide the best architecture which can scale out when in need.
Related
I want to realize sharding (horizontal partition of table), and I am using SQL Server Standard edition. I don't have any knowledge.
I searched : mysql can use sharding platform. U think dbms can support this.
But I didn't find any article about SQL Server.
Do I have to develop sharding on source code level? Or do I use any function on SQL Server?
Please give to me idea!
Thanks
I am using SQL Server 2017 Standard edition.
You can create horizontal partitioning in SQL Server using Partitioned Views or table partitioning table partitioning
Microsoft doesn't use the term sharding, but the end result is the same
We have a requirement where we will have to move data between different database instance on regular basis. (For e.g. some customers willing to pay more for the better performance). So this is not going to be one off.
The database tables has referential integrity. Is there a way in which this can be done without rewriting sql script (or some other method) every time we migrate customers data?
I came across this How to move data between multiple database's table while maintaining foreign-key relationships/referential integrity?. However it appears that we have write script every time we migrate data (please correct me if I misunderstood the answer on this thread).
Thanks
Edit:
Both servers are using SQL Server 2012 (same version). Its an Azure SQL Server database.
They are not necessarily linked (no firewall between them)
We are only transferring some data, not the whole database. This is only for certain customers who opted pay more.
The schema are exactly same in both databases.
Preyash - please see the documentation on the Split-Merge tool. The Split-Merge tool enables you do move data between databases, as you have described, based on a sharding key (e.g., customer ID). One modification that you will need for your application is to add a shard map (i.e., a database that understand the global state of which customers resides in which databases).
Have a look into Azure Data Sync. It is much more aligned with your requirements. But you may end up in having another SQL Azure DB to maintain a Hub. Azure data Sync follows hub-spoke pattern and will let you do all flexible directional syncs with a few minutes of syncing gap. It is more simple and can set it up very fast without any scripts and all as you wanted.
I have a big SQL Server 2012 database.
I want to split it into preferences and data.
However I find that SQL Server does not seem to support the idea of dividing your data up into object oriented databases. It seems to rely on everything being in the same database.
For example foreign keys are not supported in database. Also cross database joins are a real pain to do.
How would someone typically go about doing this? Is it just a limitation of SQL Server that I should use the same DB for everything?
SQl Server provides partitioning feature. As per wikipedia
A partition is a division of a logical database or its constituting elements into distinct independent parts. Database partitioning is normally done for manageability, performance or availability reasons
1.Horizontal partitioning
2.Vertical partitioning
Each has it is own file group.it can be configured
Visit this links that should help
MSDN
SQLAuthority
I am sure there are plenty of tutorials out there.
SQL Server is a relational database, so there really shouldn't be an expectation that it would support a fundamentally different architecture implied by an object or object-oriented database.
I don't understand your comment that "foreign keys are not supported in database." Foreign keys are all part of the integrity constraints in SQL Server, and a detail description of how to create them is available here
I think you might want to be more specific about the type of data you're trying to split up, and why you want to put them in physically separate databases. A refinement of your problem might help us provide better answers.
Our client wants to support both SQL Server and Oracle in the next project. Our experience comes from .NET/SQL Server platform. We will hire an Oracle developer, but our concern is with the DataAccess code. Will NHibernate make the DB Engine transparent for us? I don't think so, but i would like to hear from developers who have faced similar situations.
I know this question is a little vague, because i don't have Oracle experience, so i don't know what issues we will find.
You can easily use NHibernate to make your application database-agnostic by following some basic practices:
Design your object model first.
Do not use any database-specific code. You need somebody with good C# experience, not an Oracle developer. Do not rely on stuff like triggers, stored procedures, etc.
Let NHibernate generate the DB schemas at least initially (you can tweak things like indexes later) It will choose the best available datatypes for each DB.
Use a DB-agnostic POID generator (hilo or guid) instead of sequences or identity.
Try to avoid using SQL. HQL and Linq work fine in 99% of the cases.
Avoid NH features that are not supported by all of your target DB (for example, Future, MultiCriteria, etc)
NHibernate has a great community. You can always ask your questions in http://groups.google.com/group/nhusers besides posting here.
There are three things to consider - the ISession object, the SQL queries that are generated and your plain-old-clr-objects that are mapped to tables.
NHiberante will generate the required SQL queries based upon the chosen database dialect. If you configure NHibernate to use the SQL Server dialect it will generate SQL server correct SQL statements. This can easily be configured dynamically at runtime based on configuration.
You also need to configure your session to connect to the right type of database. Again, various configuration methods can support dynamic ISession creation at runtime.
Your actual data objects which are mapped to tables should not need to change based on database choice. One of NHibernates strengths is flexibility it provides in supporting multiple databases via a (fairly) simply configuration change and some up-front architectural thought.
See http://codebetter.com/blogs/karlseguin/archive/2009/03/30/using-nhibernate-with-multiple-databases.aspx for some examples of how you might abstract the underlying database away from the creation and usage of NHibernate.
Does anyone know a good reference to look into what Object Relational features are available in SQL Server (any version)? I found a really good summery for Oracle but all I can find for SQL Server is information about LINQ to SQL, which is good stuff, but I'm looking for more power in the database like defined types, nested tables, etc.
I know you can use CLR types in SQL Server, and that would be interesting to me too, I just am looking for a good place to read about all the OR features it has.
PS. I'm willing to purchase a book.
You should read Best Practices for Semantic Data Modeling for Performance and Scalability.
The SQL Server is not as object relational as one might expect - not that long ago I realized that it does not (even) support table inheritance.