February 27, 2013 at 7:10 am
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?
February 27, 2013 at 7:19 am
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
February 27, 2013 at 7:28 am
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.
February 27, 2013 at 7:54 am
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
July 26, 2013 at 6:22 am
You have mentioned 1.6TB(600 date + 1Tb Index).
What does this mean by 1Tb of Index.
Please make me clear....
July 26, 2013 at 9:55 am
It's size of indexes 1 TB
July 27, 2013 at 1:08 am
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
July 27, 2013 at 10:05 am
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
Change is inevitable... Change for the better is not.
July 27, 2013 at 10:17 am
GilaMonster..please make me clear with details..
July 27, 2013 at 4:48 pm
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
Change is inevitable... Change for the better is not.
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy