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


Table Partitioning


Table Partitioning

Author
Message
muth_51
muth_51
Mr or Mrs. 500
Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)

Group: General Forum Members
Points: 538 Visits: 2871
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?
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47427 Visits: 44405
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, MVP, M.Sc (Comp Sci)
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


muth_51
muth_51
Mr or Mrs. 500
Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)

Group: General Forum Members
Points: 538 Visits: 2871
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.
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47427 Visits: 44405
Or switch them into a partioned archive table and maybe merge the partitions.


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
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


skpani
skpani
Grasshopper
Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)

Group: General Forum Members
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....
muth_51
muth_51
Mr or Mrs. 500
Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)Mr or Mrs. 500 (538 reputation)

Group: General Forum Members
Points: 538 Visits: 2871
It's size of indexes 1 TB
skpani
skpani
Grasshopper
Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)

Group: General Forum Members
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
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45450 Visits: 39946
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.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
skpani
skpani
Grasshopper
Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)

Group: General Forum Members
Points: 11 Visits: 37
GilaMonster..please make me clear with details..
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45450 Visits: 39946
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.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
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