Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Table Partitioning Expand / Collapse
Author
Message
Posted Wednesday, February 27, 2013 7:10 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Yesterday @ 6:34 PM
Points: 351, Visits: 1,653
We have a table with almost 2 billion rows and we have partitioned this table based on date. The size of the table including indexes is 1.6 TB( 600 data + 1TB index). We have 14 indexes on this table. Recently a developer tried to query this table and got timed out issue because he was using the fields not in indexes. He was trying to pull last 3 months data.

My question over here is how to maintain these indexes on this partitioned table? Is it good to seperate the old partitions(switch) into archive tables and add new partitions ? What's the best way to maintain this table?
Post #1424522
Posted Wednesday, February 27, 2013 7:19 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 11:47 AM
Points: 41,525, Visits: 34,442
The entire point of partitioning is ease of archiving and easier maintenance. It's not a performance tuning technique.


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1424526
Posted Wednesday, February 27, 2013 7:28 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Yesterday @ 6:34 PM
Points: 351, Visits: 1,653
Thanks Gila.

We are not archiving this table. Just adding rows to it which is causing more issues. As the table is growing bigger and bigger. So as said in my previous comment just switch the old partitions into individual archive tables.
Post #1424530
Posted Wednesday, February 27, 2013 7:54 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 11:47 AM
Points: 41,525, Visits: 34,442
Or switch them into a partioned archive table and maybe merge the partitions.


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1424548
Posted Friday, July 26, 2013 6:22 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, August 26, 2013 6:33 AM
Points: 11, Visits: 37
You have mentioned 1.6TB(600 date + 1Tb Index).
What does this mean by 1Tb of Index.
Please make me clear....
Post #1477960
Posted Friday, July 26, 2013 9:55 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Yesterday @ 6:34 PM
Points: 351, Visits: 1,653
It's size of indexes 1 TB
Post #1478077
Posted Saturday, July 27, 2013 1:08 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, August 26, 2013 6:33 AM
Points: 11, Visits: 37
Yes I understood that your Index size is 1Tb.But as per your question you have 14 indexes(if i am not wrong you must have 13 non clustered index and one clustered index). But one index is used on a column .Then how a data size is isolated from index size ?
How Index size increases ?
Give me a brief detail on it

Post #1478269
Posted Saturday, July 27, 2013 10:05 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 4:43 PM
Points: 35,954, Visits: 30,242
Skpani (7/27/2013)
Yes I understood that your Index size is 1Tb.But as per your question you have 14 indexes(if i am not wrong you must have 13 non clustered index and one clustered index). But one index is used on a column .Then how a data size is isolated from index size ?
How Index size increases ?
Give me a brief detail on it



I'm sure that Gail will be able to explain in much more detail but, from a 60,000 foot view, Indexes are stored in a manner similar to tables. In fact, the Clustered Index IS the table (the leaf level of the clustered index is the actual data in the table). Non clustered indexes have a B-Tree and a leaf level. Storage of this index information is tracked separately by SQL Server and you can get a lot of the information about how much space an index uses from various system tables and data management views. If you want some grand detail, look at and analyze the code for the system stored procedure called sp_SpaceUsed.

The indexes for a table can also be partitioned just like table data.

As Gail said, the goal of partitioning usually isn't for any type of performance gain all though a performance gain can occasionally be realized (usually on bad code that does a table scan without the partitioning). The purpose of proper partitioning is to make index an other types of maintenance easier and certain types of backups take less space (especially on tape) and MUCH less time. With some real forethought, they can allow for "Piece-Meal" restores to allow the critical parts of a system to be restored much more quickly in the case of a total system failure or a database corruption failure.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

"Change is inevitable. Change for the better is not." -- 04 August 2013
(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1478291
Posted Saturday, July 27, 2013 10:17 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, August 26, 2013 6:33 AM
Points: 11, Visits: 37
GilaMonster..please make me clear with details..
Post #1478294
Posted Saturday, July 27, 2013 4:48 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 4:43 PM
Points: 35,954, Visits: 30,242
skpani (7/27/2013)
GilaMonster..please make me clear with details..


My recommendation would be to look up "Clustered Indexes" and "Non Clustered Indexes" in Books Online so that you'll at least be familiar with the terms before asking for such help. Just in case you don't know, "Books Online" is the "help" system that comes with SQL Server. In SSMS, press the {f1} key to get there.

Also, did you do as I recommended and look at the code for sp_SpaceUsed?

If you really want to learn something, you have to put your shoulder into it.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

"Change is inevitable. Change for the better is not." -- 04 August 2013
(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1478316
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse