[ 
https://issues.apache.org/jira/browse/DERBY-4121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689873#action_12689873
 ] 

Knut Anders Hatlen commented on DERBY-4121:
-------------------------------------------

My understanding of the code is that we store the number of unique values, not 
the average number of duplicates. The selectivity is calculated this way (from 
StatisticsImpl.java):

        public double selectivity(Object[] predicates)
        {
                if (numRows == 0.0)
                        return 0.1;

                /* xxxSTATresolve: for small values of numRows, should we do 
something
                 * special? 
                 */
                return (double)(1/(double)numUnique);
        }

If the number of rows is doubled, and the average number of duplicates per 
value doesn't change, this method will return a selectivity that is two times 
as high as it should be if we don't update the statistics.

> Documentation: more UPDATE_STATISTICS fixes needed for Reference Manual and 
> Tuning Derby
> ----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4121
>                 URL: https://issues.apache.org/jira/browse/DERBY-4121
>             Project: Derby
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 10.5.0.0
>            Reporter: Kim Haase
>            Priority: Minor
>
> Kathey Marsden comments on DERBY-3787:
> Not a show stopper for the release, but in beginning my buddy testing,
>  I noticed the examples should use CALL e.g.
> CALL SYSCS_UTIL.SYSCS_UPDATE_STATISTICS('SAMP','EMPLOYEE','PAY_DESC');
> CALL SYSCS_UTIL.SYSCS_UPDATE_STATISTICS('SAMP', 'EMPLOYEE', null);
> Also in the Tuning Guide under Working with Cardinality Statistics -> When 
> Cardinality Statistics Go Stale we should refer users to the 
> SYSCS_UTIL.SYSCS_UPDATE_STATISTICS stored procedure to update their 
> statistics and cross reference the reference guide.
> Myrna van Lunteren suggests a new issue for this, so I'm filing it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to