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 ««123»»

Very large table - performance issues Expand / Collapse
Author
Message
Posted Tuesday, May 21, 2013 10:39 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Yesterday @ 1:13 PM
Points: 60, Visits: 1,112
With 2.6 billion rows, be mindful of those INT datatypes. You have probably already considered that, just throwing it out there.
Post #1455123
Posted Wednesday, May 22, 2013 7:31 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 8:13 AM
Points: 1,708, Visits: 4,854
nivek-224024 (5/21/2013)
With 2.6 billion rows, be mindful of those INT datatypes. You have probably already considered that, just throwing it out there.


Your comment is referring to the maximum 2,147,483,647 value for Int datatype?
Post #1455504
Posted Wednesday, May 22, 2013 7:34 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 8:13 AM
Points: 1,708, Visits: 4,854
Abu Dina (5/21/2013)
We have a tall table that contains 2.6 billion rows

Table structure:



The application which uses this table has been running slow for the last couple of days and it seems to have happened following the addition of about 400 million rows last weekend.

I think it's because of the index fragmentation although I'm not sure how to check if this the case without affecting the application?

So my first question is, how do I check to see if the indexes are fragmented and whether the stats need updating on such a large table?


I notice that your clustered index is on IX_dType. Why was that column chosen to cluster the table. Especially for tables with a large number of rows, you typically want to cluster on a column with unique sequential values. There could very well be fragmentation.
Post #1455506
Posted Wednesday, May 22, 2013 7:41 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Thursday, October 16, 2014 9:28 AM
Points: 512, Visits: 433
Try running below query, will return you tables list with last statistic updated date and rows updated later on, these tables requires a statistics update with FullScan
SELECT OBJECT_NAME(id),name,STATS_DATE(id, indid),rowmodctr
FROM sys.sysindexes
WHERE STATS_DATE(id, indid)<=DATEADD(DAY,-1,GETDATE())
AND rowmodctr>0
AND id IN (SELECT object_id FROM sys.tables)

Post #1455511
Posted Wednesday, May 22, 2013 8:01 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 @ 8:19 AM
Points: 40,208, Visits: 36,617
I would disagree there, stats that are more than a day old and have a single row change absolutely do not need updating. That's almost as bad as blanket updating everything.




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 #1455522
Posted Wednesday, May 22, 2013 8:05 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Thursday, October 16, 2014 9:28 AM
Points: 512, Visits: 433
GilaMonster (5/22/2013)
I would disagree there, stats that are more than a day old and have a single row change absolutely do not need updating. That's almost as bad as blanket updating everything.



It also shows the Rows being inserted / updated / deleted after the last statistics updated, which can give good idea which table need a statistics update, instead of blanket updating everything.
Post #1455527
Posted Wednesday, May 22, 2013 8:20 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 @ 8:19 AM
Points: 40,208, Visits: 36,617
Bhaskar.Shetty (5/22/2013)
GilaMonster (5/22/2013)
I would disagree there, stats that are more than a day old and have a single row change absolutely do not need updating. That's almost as bad as blanket updating everything.



It also shows the Rows being inserted / updated / deleted after the last statistics updated, which can give good idea which table need a statistics update, instead of blanket updating everything.


Yes, however your post made no mention of making an educated decision based on the number of rows changed. It said "these tables require a statistics update with full scan", which is not necessarily true and is likely to mislead someone new to SQL that doesn't have the background to understand the nuances of statistics maintenance.



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 #1455545
Posted Wednesday, May 22, 2013 10:43 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Saturday, August 16, 2014 8:16 AM
Points: 107, Visits: 513
Have any of the queries changed? Is there maybe an unindexed column in a where clause now? Maybe one index needs a covering column added?
Post #1455611
Posted Wednesday, May 22, 2013 1:49 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, September 8, 2014 7:58 AM
Points: 13, Visits: 52
I have no idea (maybe someone else here does) but your last 400 million rows would put your DID into negative numbers - assuming it is not an unsigned int. Could that be causing a problem?
Post #1455670
Posted Wednesday, May 22, 2013 2:10 PM


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 @ 8:19 AM
Points: 40,208, Visits: 36,617
John_P (5/22/2013)
I have no idea (maybe someone else here does) but your last 400 million rows would put your DID into negative numbers - assuming it is not an unsigned int. Could that be causing a problem?


If an identity hits maxint, it doesn't loop round and start at negative numbers, instead any further inserts fail with an out of bounds error.



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 #1455695
« Prev Topic | Next Topic »

Add to briefcase ««123»»

Permissions Expand / Collapse