To check stats required for Query. Execute query after below command.
DIAGNOSTIC HELPSTATS ON FOR SESSION;
Statistical information is vital for the optimizer when query plans are built. But collecting statistics can involve time and resources. By understanding and combining several different statistics gathering techniques, users of Teradata can find the correct balance between good query plans and the time required to ensure adequate statistical information is always available.
Collect Full Statistics
1. Optimizations such as nested join, partial GROUP BY, and dynamic partition elimination will not be chosen unless statistics have been collected on the relevant columns.
2. NUPIs that are used in join steps in the absence of collected statistics are assumed to be 75% unique, and the number of distinct values in the table is derived from that. A NUPI that is far off from being 75% unique (for example, it’s 90% unique, or on the other side, it’s 60% unique or less) will benefit from having statistics collected, including a NUPI composed of multiple columns regardless of the length of the concatenated values. However, if it is close to being 75% unique, then random AMP samples are adequate. To determine what the uniqueness of a NUPI is before collecting statistics, you can issue this SQL statement:
3. For a partitioned primary index table, it is recommended that you always collect statistics on:
* Uneven distribution exists when the High Mode Frequency (ModeFrequency column in interval zero) in the histogram is greater than the average rows-per-value (RPV) by a factor of 4 or more. RPV is calculated as Number of Rows / Number of Uniques.
** Any column which is over 95% unique is considered as a neary-unique column.
*** Correlated columns within a multicolumn statistic are columns where the value in one may influence, or predict the values in the second. For example in a nation table, there is a tight correlation between nationkey and nationname. In a customer table there might be a correlation, but a somewhat looser correlation, between customer zip code and customer income band.
Dependent columns are columns where the value in the one column will tend to directly influence the value in the second column. An example of a dependent column could be customer zip code, which is dependent on the customer state. If they both appeared in a multicolumn statistic they would be a dependency between them. Other columns where there is some dependency might be job title which is sometimes dependent on the industry segment, if they both were in a multicolumn stat.
DIAGNOSTIC HELPSTATS ON FOR SESSION;
Statistical information is vital for the optimizer when query plans are built. But collecting statistics can involve time and resources. By understanding and combining several different statistics gathering techniques, users of Teradata can find the correct balance between good query plans and the time required to ensure adequate statistical information is always available.
Collect Full Statistics
- Non-indexed columns used in predicates
- All NUSIs with an uneven distribution of values *
- NUSIs used in join steps
- USIs/UPIs if used in non-equality predicates (range constraints)
- Most NUPIs (see below for a fuller discussion of NUPI statistic collection)
- Full statistics always need to be collected on relevant columns and indexes on small tables (less than 100 rows per AMP)
Can Rely on Random AMP Sampling
- USIs or UPIs if only used with equality predicates
- NUSIs with an even distribution of values
- NUPIs that display even distribution, and if used for joining, conform to assumed uniqueness (see Point #2 under “Other Considerations” below)
- See “Other Considerations” for additional points related to random AMP sampling
Option to use USING SAMPLE
- Unique index columns
- Nearly-unique columns or indexes**
Collect Multicolumn Statistics
- Groups of columns that often appear together in conditions with equality predicates, if the first 16 bytes of the concatenated column values are sufficiently distinct. These statistics will be used for single-table estimates.
- Groups of columns used for joins or aggregations, where there is either a dependency or some degree of correlation among them.*** With no multicolumn statistics collected, the optimizer assumes complete independence among the column values. The more that the combination of actual values are correlated, the greater the value of collecting multicolumn statistics will be.
Other Considerations
1. Optimizations such as nested join, partial GROUP BY, and dynamic partition elimination will not be chosen unless statistics have been collected on the relevant columns.2. NUPIs that are used in join steps in the absence of collected statistics are assumed to be 75% unique, and the number of distinct values in the table is derived from that. A NUPI that is far off from being 75% unique (for example, it’s 90% unique, or on the other side, it’s 60% unique or less) will benefit from having statistics collected, including a NUPI composed of multiple columns regardless of the length of the concatenated values. However, if it is close to being 75% unique, then random AMP samples are adequate. To determine what the uniqueness of a NUPI is before collecting statistics, you can issue this SQL statement:
EXPLAIN SELECT DISTINCT nupi- column FROM table ; |
- PARTITION. This tells the optimizer how many partitions are empty, and how many rows are in each partition. This statistic is used for optimizer costing.
- The partitioning column. This provides cardinality estimates to the optimizer when the partitioning column is part of a query’s selection criteria.
- (PARTITION, PI). This statistic is most important when a given PI value may exist in multiple partitions, and can be skipped if a PI value only goes to one partition. It provides the optimizer with the distribution of primary index values across the partitions. It helps in costing the sliding-window and rowkey-based merge join, as well as dynamic partition elimination.
- (PARTITION, PI, partitioning column). This statistic provides the combined number of distinct values for the combination of PI and partitioning columns after partition elimination. It is used in rowkey join costing.
- It provides a more accurate row count estimate for a table with a NUPI. This benefit becomes important when NUPI statistics have not been collected (as might be the case if the table is extraordinarily large), and the NUPI has an uneven distribution of values.
- Statistics extrapolation for any column in a table will not be attempted for small tables or tables whose primary index is skewed (based on full statistics having been collected on the PI), unless all-AMP random AMP sampling is turned on. Because a random AMP sample is compared against the table row count in the histogram as the first step in the extrapolation process, an accurate random AMP sample row count is critical for determining if collected statistics are stale, or not.
* Uneven distribution exists when the High Mode Frequency (ModeFrequency column in interval zero) in the histogram is greater than the average rows-per-value (RPV) by a factor of 4 or more. RPV is calculated as Number of Rows / Number of Uniques.
** Any column which is over 95% unique is considered as a neary-unique column.
*** Correlated columns within a multicolumn statistic are columns where the value in one may influence, or predict the values in the second. For example in a nation table, there is a tight correlation between nationkey and nationname. In a customer table there might be a correlation, but a somewhat looser correlation, between customer zip code and customer income band.
Dependent columns are columns where the value in the one column will tend to directly influence the value in the second column. An example of a dependent column could be customer zip code, which is dependent on the customer state. If they both appeared in a multicolumn statistic they would be a dependency between them. Other columns where there is some dependency might be job title which is sometimes dependent on the industry segment, if they both were in a multicolumn stat.
41 comments:
Very nice article. I absolutely love this website. Thanks!
my homepage make money fast online
It's appropriate time to make a few plans for the future and it's time to be happy.
I have read this post and if I may just I desire to suggest you
few fascinating things or suggestions. Maybe
you can write subsequent articles referring to this article.
I desire to read more issues about it!
Here is my webpage: part time jobs online
What's up Dear, are you in fact visiting this website regularly, if so after that you will absolutely obtain pleasant knowledge.
Here is my blog; how to earn money onlinefast money
Also see my web site > best way to earn money onlineeasiest ways to make money
What's up friends, how is everything, and what you would like to say on the topic of this post, in my view its truly amazing in support of me.
Have a look at my page how to work from home and make good money
Wonderful blog! Do you have any suggestions for aspiring writers?
I'm planning to start my own website soon but I'm a little lost on everything.
Would you recommend starting with a free platform like Wordpress or go for a paid option?
There are so many options out there that I'm completely overwhelmed .. Any recommendations? Kudos!
My web blog ... work at home jobs in pa
Hello, i read your blog from time to time and i own a
similar one and i was just curious if you get
a lot of spam feedback? If so how do you stop it, any plugin or anything you can suggest?
I get so much lately it's driving me crazy so any assistance is very much appreciated.
Here is my homepage - forex candlestick patterns
Thanks in favor of sharing such a nice idea, post is pleasant, thats why
i have read it completely
Visit my blog post; how to make legitimate money from home
I've been browsing on-line more than three hours today, yet I never discovered any attention-grabbing article like yours. It is beautiful value enough for me. Personally, if all website owners and bloggers made excellent content as you did, the net will be a lot more helpful than ever before.
Here is my homepage :: how to make extra money online
Definitely consider that that you said. Your favorite justification appeared
to be at the web the simplest thing to understand of. I say to
you, I certainly get irked at the same time as other folks consider concerns that
they just don't recognise about. You controlled to hit the nail upon the top as well as outlined out the entire thing without having side-effects , people could take a signal. Will likely be back to get more. Thank you
Feel free to visit my web-site: day trading for beginnersforex tutorial
My webpage :: stock market day tradingforex investment
Thanks a lot for sharing this with all of us you actually recognize
what you are talking approximately! Bookmarked. Please also discuss
with my web site =). We can have a link exchange agreement among us
my webpage ... get money now free
Hi, I read your new stuff like every week.
Your humoristic style is awesome, keep up the good work!
My blog post: ways to make money quick
Hey There. I found your blog using msn. That is an extremely smartly written article.
I'll be sure to bookmark it and return to learn extra of your useful info. Thanks for the post. I'll certainly return.
Take a look at my page; how to make your money grow fast
This is a really good tip especially to those new to the blogosphere.
Brief but very precise info… Appreciate your sharing this one.
A must read article!
Also visit my web blog - how to make money without a job
my website - easiest way to make money
Unquestionably believe that which you said.
Your favorite reason appeared to be on the net the easiest thing to be aware of.
I say to you, I definitely get annoyed while people consider
worries that they just don't know about. You managed to hit the nail upon the top and also defined out the whole thing without having side-effects , people could take a signal. Will probably be back to get more. Thanks
My blog post: online work from home jobs
my website: earn real money online
My brother recommended I may like this web site. He was once totally right.
This submit truly made my day. You cann't consider just how a lot time I had spent for this info! Thank you!
my site - make money fast and easy
Pretty nice post. I just stumbled upon your weblog
and wanted to say that I've truly enjoyed browsing your blog posts. In any case I will be subscribing to your feed and I hope you write again very soon!
my web site the best way to make money from home
My webpage :: best way to earn money online
I think the admin of this website is truly working hard for
his web site, because here every stuff is quality based information.
Feel free to surf to my blog post ... make money from home
My web page: work from home jobs in nj
We're a group of volunteers and starting a new scheme in our community. Your web site provided us with valuable information to work on. You have done a formidable job and our entire community will be grateful to you.
my web-site how to make money fast and easy
This is very interesting, You are a very skilled blogger.
I have joined your feed and look forward to seeking more of your excellent post.
Also, I've shared your web site in my social networks!
Here is my website how do i earn money
Also see my web page: how to make money online for free and fast
Very nice write-up. I certainly love this website.
Continue the good work!
my blog post :: day trading penny stocks
Piece of writing writing is also a excitement,
if you know then you can write otherwise
it is complicated to write.
Review my blog post: what is the best way to make money
Thanks for your marvelous posting! I genuinely enjoyed reading it, you happen to be a
great author. I will ensure that I bookmark your blog and definitely will come back at
some point. I want to encourage you to definitely continue your great work, have a
nice holiday weekend!
Here is my homepage - earn money online fast and free
my page - earn extra money fast
Oh my goodness! Awesome article dude! Thank you so much, However I am encountering issues with your RSS.
I don't understand the reason why I can't join it.
Is there anybody else having identical RSS issues?
Anyone who knows the answer will you kindly respond?
Thanx!!
Also visit my weblog :: make free money online
You actually make it seem so easy with your presentation but I find this matter to be actually something that I think I would never understand.
It seems too complicated and very broad for me.
I am looking forward for your next post, I'll try to get the hang of it!
Feel free to visit my weblog ... free money from government
Hey fantastic website! Does running a blog like this require a lot
of work? I have very little knowledge of computer programming however I was hoping to start
my own blog soon. Anyhow, if you have any recommendations or techniques
for new blog owners please share. I know this is off topic
however I simply had to ask. Thank you!
Also visit my webpage: how to make money online fast and free
My web page: How do You Make money blogging
Howdy would you mind letting me know which hosting company you're utilizing? I've loaded your blog
in 3 completely different internet browsers and I must say this blog loads a lot quicker then most.
Can you recommend a good hosting provider at a fair price?
Kudos, I appreciate it!
my homepage - I Want free Money
I think this is among the most important info for me.
And i'm glad reading your article. But want to remark on few general things, The web site style is great, the articles is really nice : D. Good job, cheers
Stop by my site ... free money making website
Wow, this piece of writing is fastidious, my younger
sister is analyzing such things, so I am going to let know her.
Feel free to surf to my web page: easy ways to make money online for free
Hello There. I found your blog using msn. This is an extremely well written
article. I will make sure to bookmark it and return
to read more of your useful information. Thanks for the post.
I'll definitely comeback.
Take a look at my web blog; mit uploads geld verdienen
Oh my goodness! Incredible article dude! Many thanks, However I am encountering difficulties with your RSS.
I don't understand why I can't join it. Is there anybody else getting the same RSS issues?
Anyone who knows the solution can you kindly respond?
Thanx!!
Feel free to surf to my web site; binary options brokers
My webpage - binary options
Hello there! Quick question that's completely off topic. Do you know how to make your site mobile friendly? My weblog looks weird when browsing from my iphone4. I'm trying to find a theme or plugin that might be able to
fix this problem. If you have any suggestions, please share.
Appreciate it!
Here is my site binary options forex
Also see my page: forex binary options brokers
Very descriptive blog, I liked that bit. Will there be a part 2?
Also visit my weblog: ways to make money online fast
Thanks for sharing your thoughts on applyfor free grants.
Regards
my webpage ... i need money fast and free
Thank you for the auspicious writeup. It in fact was
a amusement account it. Look advanced to more added agreeable from you!
However, how could we communicate?
Also visit my website - make money online surveys
I am really grateful to the holder of this website who has shared this enormous post
at here.
My website - earn money online fast
Very nice post. I just stumbled upon your blog and wished to mention that I've really loved surfing around your blog posts. In any case I'll
be subscribing in your feed and I am hoping you write
once more very soon!
My web-site - legitimate work from home jobs
I was suggested this web site by my cousin. I'm not sure whether this post is written by him as nobody else know such detailed about my problem. You're incredible!
Thanks!
Here is my web-site; Geld verdienen
I love your blog.. very nice colors & theme. Did you design this website yourself or did you hire someone to do it for
you? Plz reply as I'm looking to create my own blog and would like to find out where u got this from. appreciate it
Have a look at my weblog geld verdienen mit affiliate
Also see my website: Geld verdienen im Internet
Thanks very interesting blog!
My web site :: need free money today
I was extremely pleased to find this site.
I wanted to thank you for ones time just for this fantastic read!
! I definitely appreciated every bit of it and
i also have you book-marked to see new things in your blog.
Feel free to visit my blog ... make money fast and easy
I feel that is one of the most important information for me.
And i'm glad studying your article. However wanna statement on few common things, The web site style is perfect, the articles is truly nice : D. Just right activity, cheers
my page: Earn money online fast and free
Post a Comment