SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Partitioning in SQL Server 2008


Partitioning in SQL Server 2008

Author
Message
chapman.tim
chapman.tim
SSC-Enthusiastic
SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)

Group: General Forum Members
Points: 129 Visits: 332
Of course, if you're partitioning by date (the way it was really intended), and you always include a date in the predicate, the benefits of partitioning would likely outweigh the drawbacks.
Francis Incourt
Francis Incourt
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 34
Nice post. I have the following situation :

My table contains 2 years of history and 5 billions of records.
I took the option to create partition per week. Each week is about 70 millions of rows and size on disk of each partition is about 4-5 GB.
After 2 years, I have 100+ physical partitions and same number of filegroups, one per partition.

I must say it runs quiet well and my table is used only to feed an olap cube.
Is this the right approach ?

My collegue told me that create so many partitions was not necessary and that SQL server would better perform if there were , let's say 4 or 5 big partitions of 200 GB each ...

Any feedback would be appreciated.
chapman.tim
chapman.tim
SSC-Enthusiastic
SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)SSC-Enthusiastic (129 reputation)

Group: General Forum Members
Points: 129 Visits: 332
I really don't think it is the number of partitions that really matter in this case, more of how you're using them. If you're always accessing your data based on the date (which is the field you're partitioning on), then its the right setup. I assume you're using the partitioning to load data based on a SWITCH statement, correct? Also, I believe SQL 2008 SP2 now allows up to 15000 partitions.
jslingrowd
jslingrowd
Grasshopper
Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)

Group: General Forum Members
Points: 12 Visits: 25
Is there any significant performance gain to partition tables on SSD drives? Is partitioning mainly to reduce seek times in rotational disk drives? Thx.
SQLBrigade
SQLBrigade
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 Visits: 26
There is an error with the create partition scheme; there are not enough filegroups to support the partition function.

You create more filegroups or share partitions across filegroups like:

CREATE PARTITION SCHEME MyPartitionScheme AS
PARTITION MyPartFunc TO([FG1], [FG2],[FG1], [FG2],[FG1],[FG2])
GO
nahka163
nahka163
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 29
Hi, I am new in table partitioning and this article gave me a clear picture of how to partition a table in 2008. I hope you are writing more articles about this subject matter. Step by step a working partitioning of a table would be appreciated. Thanks again you have been a great help.

Alia
jansub07
jansub07
SSC Journeyman
SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)

Group: General Forum Members
Points: 97 Visits: 141
What happen if one of my client using standard edition as i use partition in my product?
Any other way to introduce the partition concept in standard edition
KTD
KTD
SSC-Enthusiastic
SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)

Group: General Forum Members
Points: 124 Visits: 373
I have been looking for some info on A.) Putting my most recent data and indexes in the partitioned table on SSD drives. B.) You touched on using Partitioned tables to archive the oldest data. I haven't found much on these topics.

I don't always test my SQL scripts, but when I do, I test in Production.
rajiv.singh1237
rajiv.singh1237
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 Visits: 20
Correct example: Updated existing code

1)
USE master
GO
CREATE DATABASE MyPartitionPracticeDB
ON PRIMARY
( NAME = db_dat,
FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\MyPartitionPracticeDB.mdf',
SIZE = 50MB),

FILEGROUP FG1
( NAME = FG1_1_dat,
FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\MyPartitionPracticeDBFG1.ndf',
SIZE = 2MB),
( NAME = FG1_2_dat,
FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\MyPartitionPracticeDBFG1.ndf',
SIZE = 2MB),
( NAME = FG1_3_dat,
FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\MyPartitionPracticeDBFG1.ndf',
SIZE = 2MB),
( NAME = FG1_4_dat,
FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\MyPartitionPracticeDBFG1.ndf',
SIZE = 2MB),
( NAME = FG1_5_dat,
FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\MyPartitionPracticeDBFG1.ndf',
SIZE = 2MB),
( NAME = FG1_6_dat,
FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\MyPartitionPracticeDBFG1.ndf',
SIZE = 2MB)
LOG ON
( NAME = db_log,
FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\MyPartitionPracticeDBlog.ndf',
SIZE = 2MB,
FILEGROWTH = 10% );
GO
USE MyPartitionPracticeDB
GO

2)
--It will create 6 partition... 5 for mentioned range and one for left out values
CREATE PARTITION FUNCTION partFunc (int) AS
RANGE LEFT FOR VALUES (1000, 2000, 3000, 4000, 5000);

SELECT * FROM sys.partition_functions

3)
CREATE PARTITION SCHEME MyPartitionScheme AS
PARTITION Partfunc TO
([FG1], [FG1], [FG1], [FG1], [FG1], [FG1])
GO

SELECT * FROM SYS.PARTITION_RANGE_VALUES

4)
CREATE TABLE MyPartionedTable
(
ID int PRIMARY KEY,
Name VARCHAR(50)
)
ON MyPartitionScheme(ID)

Thanks,
Rajiv Singh
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search