[ http://issues.apache.org/jira/browse/DERBY-737?page=all ]

Mamta A. Satoor updated DERBY-737:
----------------------------------

    Attachment: DERBY737_v1_diff_SYSCS_COMPRESS_TABLE.txt
                DERBY737_v1_stat_SYSCS_COMPRESS_TABLE.txt

I would like to submit a patch for this Jira entry. It is attached as 
DERBY737_v1_diff_SYSCS_COMPRESS_TABLE.txt The changes have been very localized 
in AlterTableConstantAction.java!updateIndex() Currently, this method checks if 
statistics already exist for an index. If yes, then it sets a flag 
updateStatistics to true. Later, the code checks for this flag and drops the 
existing statistics and creates new statistics for that index provided the user 
table at this point is not empty. So, as we can see, if there is an index with 
no preexisting statistics, the flag updateStatistics will be set to false and 
hence no statistics related code is executed and hence even though the user 
table is not empty at the time of compress, no statistics get generated for 
such an index.

I am proposing to fix the problem by still using the flag to see if an index 
has pre-existing statistics. If yes,
then we should drop those statistics. Next, whether the index has pre-existing 
statistics or not, go ahead and
create new statistics for the index provided the user table is not currently 
empty.

I ran the derbyall suite on Windows XP with Sun JDK 1.4 and there were no new 
failures. In addition, I have added few tests to lang/compressTable.sql

Can someone please review this patch for me?

> SYSCS_UTIL.SYSCS_COMPRESS_TABLE should create statistics if they do not exist
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-737
>                 URL: http://issues.apache.org/jira/browse/DERBY-737
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 10.1.3.1, 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 
> 10.2.1.6, 10.0.2.2
>            Reporter: Kathey Marsden
>            Priority: Minor
>         Attachments: DERBY737_v1_diff_SYSCS_COMPRESS_TABLE.txt, 
> DERBY737_v1_stat_SYSCS_COMPRESS_TABLE.txt
>
>
> There must be an entry in the SYSSTATISTICS table in order for the 
> cardinality statistics in SYSSTATISTICS to be created with 
> SYSCS_UTIL.SYSCS_COMPRESS_TABLE 
> SYSCS_UTIL.SYSCS_COMPRESS_TABLE  should create statistics if they don't 
> exist.  The only way to create them if the index was created on an empty 
> table, seems to be to drop and recreate the index after the table has been 
> loaded.
> The documentation will also need updating if this change is made.
> http://db.apache.org/derby/docs/10.1/tuning/ctunstats57373.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to