Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How many partitions?


How many partitions?

Author
Message
Adi Cohn-120898
Adi Cohn-120898
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2224 Visits: 6079
I’ve noticed that there is no group by, so I selected the answer with the syntax error. Seems that I was wrong and I lost 3 points. It doesn’t matter that the question did have a syntax error:-)

--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
http://www.sqlservercentral.com/articles/Best+Practices/61537/

For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
DEK46656
DEK46656
SSC-Addicted
SSC-Addicted (462 reputation)SSC-Addicted (462 reputation)SSC-Addicted (462 reputation)SSC-Addicted (462 reputation)SSC-Addicted (462 reputation)SSC-Addicted (462 reputation)SSC-Addicted (462 reputation)SSC-Addicted (462 reputation)

Group: General Forum Members
Points: 462 Visits: 564
I also noted the lack of a GROUP BY clause. After “assuming” that it was intended, my first thought was 8 (4 for the table, 4 for the index). Since that wasn’t offered, and the error wasn’t related to the lack of a GROUP BY, I came to 4.

Beer's Law: Absolutum obsoletum
"if it works it's out-of-date"
sjimmo
sjimmo
Hall of Fame
Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)

Group: General Forum Members
Points: 3352 Visits: 2846
Question is terrible!

Took a guess because the error that should have come up was not listed, so had to guess.

Had you at least tested your QOD before posting it, you would have known this.

Steve Jimmo
Sr DBA
“If we ever forget that we are One Nation Under God, then we will be a Nation gone under." - Ronald Reagan
jeff.mason
jeff.mason
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1153 Visits: 2126
While I see the flaw in the question, folks don't have to be so mean pointing it out -- that sort of feedback would certainly keep me from offering up a question....
Stewart "Arturius" Campbell
Stewart "Arturius" Campbell
SSCertifiable
SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)SSCertifiable (5.8K reputation)

Group: General Forum Members
Points: 5802 Visits: 7137
Can't figure why the GROUP BY is not there.
the stored proc I copied the code from contains:

select $Partition.AccountBalanceDate(AccountBalanceDate) Partition, COUNT(1) RecordsPerPartition
from AccountBalanceMonthEnd with(nolock)
where $Partition.AccountBalanceDate(AccountBalanceDate) between 22 and 25
group by $Partition.AccountBalanceDate(AccountBalanceDate)
order by 1



could one of the admins at SSC please fix this?

____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Bradley Deem
Bradley Deem
Mr or Mrs. 500
Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)Mr or Mrs. 500 (567 reputation)

Group: General Forum Members
Points: 567 Visits: 1248
Doh, I choose 0 because I miscounted the number of partitions, I thought there were 21 instead of 28. Anyways, for those interested in a full executable test of the QOD see the following. I found this to be a good question (despite the GROUP BY missing) because I had not worked with partitions. Thanks!


CREATE DATABASE MyDb
ALTER DATABASE MyDB
ADD FILEGROUP Balances
GO
ALTER DATABASE MyDB
ADD FILE (NAME = N'Balances', FILENAME = 'C:\Balances.mdf') TO FILEGROUP Balances
GO
USE MyDB
GO
CREATE PARTITION FUNCTION AccountBalanceDate (DATETIME)
AS RANGE RIGHT FOR VALUES ('2008-03-31',
'2008-04-30','2008-05-31','2008-06-30','2008-07-31',
'2008-08-31','2008-09-30','2008-10-31','2008-11-30',
'2008-12-31','2009-01-31','2009-02-28','2009-03-31',
'2009-04-30','2009-05-31','2009-06-30','2009-07-31',
'2009-08-31','2009-09-30','2009-10-31','2009-11-30',
'2009-12-31','2010-01-31','2010-02-28','2010-03-31',
'2010-04-30','2010-05-31')
GO
CREATE PARTITION SCHEME schemeAccountBalanceDate
AS PARTITION AccountBalanceDate
ALL TO (Balances)
GO
IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'MyBalances')
DROP TABLE MyBalances
GO
CREATE TABLE [dbo].MyBalances(
[AccountBalanceRefNo] [uniqueidentifier] NULL,
[AccountRefNo] [uniqueidentifier] NULL,
[AccountBalanceDate] [datetime] NULL,
[CostCentreRefNo] [uniqueidentifier] NULL,
[BalanceCurrencyRefNo] [uniqueidentifier] NULL,
[BalanceAmount] [decimal](18, 3) NULL,
[AccruedInterest] [decimal](18, 3) NULL,
[ExchangeRate] [decimal](15, 7) NULL,
[BaseCurrencyRefNo] [uniqueidentifier] NULL,
[BaseAmount] [decimal](18, 3) NULL,
[BaseAccruedInterest] [decimal](18, 3) NULL)
ON schemeAccountBalanceDate([AccountBalanceDate])
GO
CREATE CLUSTERED INDEX [IX_MyBalances_Date] ON [dbo].[MyBalances]
( [AccountBalanceDate] ASC,
[AccountRefNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON schemeAccountBalanceDate(AccountBalanceDate)
GO

-- Simulate the partitions being loaded
INSERT MyBalances(AccountBalanceDate)
VALUES('2008-03-31'),
('2008-04-30'),('2008-05-31'),('2008-06-30'),('2008-07-31'),
('2008-08-31'),('2008-09-30'),('2008-10-31'),('2008-11-30'),
('2008-12-31'),('2009-01-31'),('2009-02-28'),('2009-03-31'),
('2009-04-30'),('2009-05-31'),('2009-06-30'),('2009-07-31'),
('2009-08-31'),('2009-09-30'),('2009-10-31'),('2009-11-30'),
('2009-12-31'),('2010-01-31'),('2010-02-28'),('2010-03-31'),
('2010-04-30'),('2010-05-31')

select $Partition.AccountBalanceDate(AccountBalanceDate) Partition, COUNT(1) RecordsPerPartition
from MyBalances with(nolock)
where $Partition.AccountBalanceDate(AccountBalanceDate) between 22 and 25
GROUP BY $Partition.AccountBalanceDate(AccountBalanceDate)
order by 1

GO
USE Master
DROP Database MyDB


SanjayAttray
SanjayAttray
Hall of Fame
Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)

Group: General Forum Members
Points: 3953 Visits: 1619
malleswarareddy_m (8/11/2010)
Hi ,

Is it working for sqls server 2005 or 2008?



It's introduced in 2005 version, but partition is supported only in Enterprise edition. On other editions you will get error.

Msg 7736, Level 16, State 1, Line 2
Partition function can only be created in Enterprise edition of SQL Server. Only Enterprise edition of SQL Server supports partitioning.

SQL DBA.
UMG Developer
UMG Developer
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2280 Visits: 2204
I saw the missing GROUP BY as well, but since the error option was specific to a different error, I just assumed it got left out somehow. Other than that, nice question.
SQLRNNR
SQLRNNR
SSC-Insane
SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)

Group: General Forum Members
Points: 21105 Visits: 18259
Thanks for the question.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

malleswarareddy_m
malleswarareddy_m
SSCrazy
SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)

Group: General Forum Members
Points: 2015 Visits: 1189
I know the partitoned table and partioned indexes.but frankly saying

that i thought that with out group by it will work in 2008.but my guess is wrong when i executed in sqlserver 2008.

I did not loaded the data.that's why i had done mistake and put zero as answer. Any how good question about table Partitioning.And also am expecting this type of questions thanks for the author.but next time please do not do mistake in the question.

Malleswarareddy
I.T.Analyst
MCITP(70-451)
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