Link to home
Start Free TrialLog in
Avatar of enrique_aeo
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?
Avatar of Jim P.
Jim P.
Flag of United States of America image

I'm sorry -- but I've processed more than one 40K row table without a burp. (And still had room for dessert.)

Do you want to partition for future growth?
Avatar of enrique_aeo
enrique_aeo

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?
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?
so is my dear friend, can?
SOLUTION
Avatar of sventhan
sventhan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok dear friend, today I do the test at night and you notice how I was, thanks for your contribution. Greetings
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.SalesOrderHeader   CROSS JOIN AdventureWorks.Sales.SalesOrderDetail
      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