Recent PostsRecent Posts Popular TopicsPopular Topics
 Home Search Members Calendar Who's On

 Data distribution Rate Topic Display Mode Topic Options
Author
 Message
 Posted Tuesday, January 08, 2013 4:52 PM
 SSC Veteran Group: General Forum Members Last Login: Thursday, November 21, 2013 1:45 PM Points: 293, Visits: 1,026
 How can I find data distribution for a column?
Post #1404497
 Posted Tuesday, January 08, 2013 5:19 PM
 SSCertifiable Group: General Forum Members Last Login: Wednesday, November 06, 2013 6:20 PM Points: 5,742, Visits: 6,230
 What exactly are you looking for, the heuristics?I mean, straight data distribution could be done with a SELECT column, COUNT(*) AS cnt FROM table GROUP BY column.Can you be a little more specific as to what exactly you're trying to determine? - Craig FarrellNever stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake. For better assistance in answering your questions | Forum NetiquetteFor index/tuning help, follow these directions. |Tally TablesTwitter: @AnyWayDBA
Post #1404502
 Posted Wednesday, January 09, 2013 4:41 AM
 SSChampion Group: General Forum Members Last Login: Yesterday @ 9:54 AM Points: 13,863, Visits: 26,126
 If the column has statistics on it, those represent the data distribution as SQL Server understands it. You can use DBCC SHOW_STATISTICS to see the density, also known as selectivity, and the histogram, which is the data distribution. If statistics don't exist for the column, you can just create them manually using CREATE STATISTICS. Then take a look at the distribution using SHOW_STATISTICS. ----------------------------------------------------"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2012 Query Performance TuningSQL Server 2008 Query Performance Tuning Distilled and SQL Server Execution PlansProduct Evangelist for Red Gate Software
Post #1404677
 Posted Wednesday, January 09, 2013 7:50 AM
 SSC Veteran Group: General Forum Members Last Login: Thursday, November 21, 2013 1:45 PM Points: 293, Visits: 1,026
 Grant Fritchey (1/9/2013)If the column has statistics on it, those represent the data distribution as SQL Server understands it. You can use DBCC SHOW_STATISTICS to see the density, also known as selectivity, and the histogram, which is the data distribution. If statistics don't exist for the column, you can just create them manually using CREATE STATISTICS. Then take a look at the distribution using SHOW_STATISTICS.This is what I needed. Thanks a lot Grant.
Post #1404796

 Permissions