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


How to Check Partition is Working or not


How to Check Partition is Working or not

Author
Message
niladri.primalink
niladri.primalink
SSC-Enthusiastic
SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)SSC-Enthusiastic (117 reputation)

Group: General Forum Members
Points: 117 Visits: 226
Hi All,

In a database (partitionDB) I have created partition then I have crated table on that DB. In another database (Partitiondb_New) I have the same table but here is no partition. In both the datbases there is a table 'Orders'.

I have used the following query to partition the database (partitionDB)
Create PARTITION FUNCTION PFORDERDATERANGE (DATETIME)
AS
RANGE RIGHT FOR VALUES ('2011-05-04','2011-08-04','2011/11/04','2013/01/04','2013/04/04','2013/07/04')

Create Partition Scheme PSOrderDateChange
as
Partition PFORDERDATERANGE to (FG1, FG2, FG3, FG4, FG5, FG6, [Primary])

Create table dbo.orders
(
Orderid int identity (1,1) not null,
[Orderdate] [datetime] not null,
[Name] nvarchar (255),
[Productid] int null,
constraint [pk_orders] primary key clustered ( Orderid ASC, Orderdate ASC )
ON PSOrderDateChange (OrderDate)
)
on PSOrderDateChange (OrderDate)


Lastly I have checked to see which filegroups contain how may records
select $partition.PFORDERDATERANGE (o.orderdate) as [Prtition Number],
Min(o.orderdate) as [Min Value],
max (o.orderdate) as [Max Value],
Count(*) [records in Partition]
from Orders o
Group by $partition.PFORDERDATERANGE (o.orderdate)
order by [Prtition Number]


and I am getting result. to see the result and performance issue I ran a query in both the databases
select * from dbo.Orders
where Orderdate between '2013-01-04 00:00:00.000' and '2013-04-03 00:00:00.000'


but in both the scenario I am getting output in 8 secs....

then How will I use partition in my database or table?

I am sure someone will show the right direction....

Thanks in advance
Igor Micev
Igor Micev
SSCarpal Tunnel
SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)

Group: General Forum Members
Points: 4166 Visits: 4849
Hi
Maybe following link https://www.simple-talk.com/sql/database-administration/gail-shaws-sql-server-howlers/ will enclear some things to you.


Igor Micev,
‌SQL Server developer at Seavus
www.seavus.com
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