enrique_aeo
asked on
sql server 2008: as a partition a table with 40.000 rows?
CREATE PARTITION FUNCTION pfPart1 (int)
AS RANGE LEFT FOR VALUES (10000, 20000, 30000, 40000)
--5
CREATE PARTITION SCHEME psPart1
AS PARTITION pfPart1
TO (pfg01, pfg02, pfg03, pfg04, pfg05)
--6
Create Table tPart1
(IdPart Int, Nombre Varchar(20), Cantidad Int, Valor Decimal(12,5))
I have a table without partitions, which has 40,000 rows
I created the function and partition scheme
As the table to alter that uses the partition scheme?
AS RANGE LEFT FOR VALUES (10000, 20000, 30000, 40000)
--5
CREATE PARTITION SCHEME psPart1
AS PARTITION pfPart1
TO (pfg01, pfg02, pfg03, pfg04, pfg05)
--6
Create Table tPart1
(IdPart Int, Nombre Varchar(20), Cantidad Int, Valor Decimal(12,5))
I have a table without partitions, which has 40,000 rows
I created the function and partition scheme
As the table to alter that uses the partition scheme?
ASKER
information is just an example. I know the syntax
< information is just an example. I know the syntax
What you would like know about the partition then?
What you would like know about the partition then?
ASKER
As the table to alter that uses the partition scheme?
Do you like to create a non-partitioned table to partitioned by using alter command?
ASKER
so is my dear friend, can?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok dear friend, today I do the test at night and you notice how I was, thanks for your contribution. Greetings
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
CREATE TABLE [dbo].tabla_demo
(
id int identity,
c varchar(200) NULL
)
go
declare @i int
set @i = 1
while @i<=10 -- Luego 1.000.000 filas
begin
INSERT INTO dbo.tabla_demo
SELECT top (50000)
replace(cast(NEWID() as varchar(100)), '-','') + REPLICATE('a', 200-32)
FROM AdventureWorks.Sales.Sales OrderHeade r CROSS JOIN AdventureWorks.Sales.Sales OrderDetai l
print cast (@i as varchar(100))
set @i=@i+1
end
CREATE PARTITION FUNCTION pfPartEE (int)
AS RANGE LEFT FOR VALUES (10000, 20000, 30000, 40000)
--5
CREATE PARTITION SCHEME psPartEE
AS PARTITION pfPartEE
TO (pfg01, pfg02, pfg03, pfg04, pfg05)
CREATE CLUSTERED INDEX [idx_id]
ON dbo.tabla_demo([id]) ON psPartEE([id])
SELECT $PARTITION.pfPartEE(id) AS Particion,
COUNT(*) AS NumeroRegistros FROM tabla_demo
GROUP BY $PARTITION.pfPartEE(id)
ORDER BY Particion
(
id int identity,
c varchar(200) NULL
)
go
declare @i int
set @i = 1
while @i<=10 -- Luego 1.000.000 filas
begin
INSERT INTO dbo.tabla_demo
SELECT top (50000)
replace(cast(NEWID() as varchar(100)), '-','') + REPLICATE('a', 200-32)
FROM AdventureWorks.Sales.Sales
print cast (@i as varchar(100))
set @i=@i+1
end
CREATE PARTITION FUNCTION pfPartEE (int)
AS RANGE LEFT FOR VALUES (10000, 20000, 30000, 40000)
--5
CREATE PARTITION SCHEME psPartEE
AS PARTITION pfPartEE
TO (pfg01, pfg02, pfg03, pfg04, pfg05)
CREATE CLUSTERED INDEX [idx_id]
ON dbo.tabla_demo([id]) ON psPartEE([id])
SELECT $PARTITION.pfPartEE(id) AS Particion,
COUNT(*) AS NumeroRegistros FROM tabla_demo
GROUP BY $PARTITION.pfPartEE(id)
ORDER BY Particion
Do you want to partition for future growth?