Home > SQL Server Tips > Database Management and Administration > Improving partition views in SQL Server
SQL Server Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

DATABASE MANAGEMENT AND ADMINISTRATION

Improving partition views in SQL Server


Barrie Sosinsky
12.20.2004
Rating: --- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Partitioning SQL data sets is an ideal way to improve scale out, and distributed partitioning is particularly valuable in this regard. Here I will explain the benefits of using partitioned views, and offer some points to keep in mind when defining and creating them.

A partitioned view will show row data (horizontal partitioning) from one or more tables, across one or more servers. When a single server is used, the view is referred to as a local-partitioned view. When this type of view spans more than one server, it is a distributed-partitioned view. Distributed-partition views were added in SQL Server 2000, and the collection of instances on different servers is sometimes referred to as a federated database server set. To read about distributed-partition views, see this white paper.

You should use partitioned views to improve performance when dealing with large data sets. They are useful when you have a table that is used by many groups, departments or regions, and each has its own server. In this instance, you can partition your database on a per server basis to service these different entities.

Viewing fewer rows has several desirable effects. In addition to improving performance, you can present data customized for individuals and groups, and you can enhance system security by providing specific data access based on these partitioned views. Using these views allows you to break apart your large data set into separate smaller member tables or to use a UNION ALL operation to reconstruct the entire data set.

For a UNION ALL, multiple queries are combined and duplicate values are removed if the ALL clause is left unspecified. A SELECT run against a distributed-partitioned view is usually defined against a primary key and uses the CHECK constraint to return the ResultSet. A local-partitioned view doesn't require that you use a CHECK constraint as the source of the data is already known.

When defining a partitioned view, be careful to reference all columns in each member table. Also check that you don't double list a column in your SELECT statement, and make sure every identically-named column in each of the separate partitions is the same data type and therefore compatible. You can list a referenced member table in your view by including its name in the FROM clause of your SELECT statement. One common mistake is not including the primary key in each table or defining it correctly, so make sure you always double check that as well.

If you create partitioned views, keep in mind that you can use each member table's SELECT statement to create a view you are able to update. While the SELECT statement is used to create the base table, the UNION ALL operator can collect all of the ResultSets with any remote table containing an additional identifier.

Rate this Tip
To rate tips, you must be a member of SearchSQLServer.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Database Management and Administration
Using traces in SQL Server Profiler
Meet compliance requirements with improved database security practices
Hardening the network and OS for SQL Server security
Securing the server and database in SQL Server
How SQL Server 2008 components impact SharePoint implementations
Troubleshooting Distributed Transaction Coordinator errors in SQL Server
Achieving high availability and disaster recovery with SharePoint databases
Clearing the Windows page file and its effect on server performance
Deploying a SQL Server virtual appliance for Microsoft Hyper-V
How to create SQL Server virtual appliances for Hyper-V

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



SQL Server Development - .NET, C#, T-SQL, Visual Basic
HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2005 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts