Terry,

thank you for reporting this. Since the cardinality reported by SHOW TABLE
STATUS is just an  estimate, this is not strictly a bug, but it is best to
correct this anyway.

I modified the cardinality estimation algorithm to 4.0 in March 2004, but
forgot the case where the index B-tree just contains one page.

"
D 1.33 04/03/19 22:49:08+02:00 [EMAIL PROTECTED] 51 50 20/4/3573
P innobase/btr/btr0cur.c
C Fix bug: The row count and key cardinality estimate was grossly too small
if each clustered index page only contained one record
"

I have now corrected the code so that it takes the 1 page case into account:

"
                if (n_cols == dict_index_get_n_unique_in_tree(index)) {

                        /* If there is more than one leaf page in the tree,
                        we add one because we know that the first record
                        on the page certainly had a different prefix than
the
                        last record on the previous index page in the
                        alphabetical order. Before this fix, if there was
                        just one big record on each clustered index page,
the
                        algorithm grossly underestimated the number of rows
                        in the table. */

                        if (btr_page_get_prev(page, &mtr) != FIL_NULL
                            || btr_page_get_next(page, &mtr) != FIL_NULL) {

                                n_diff[n_cols]++;
                        }
                }
"

The fix will probably appear in 4.0.21 and 4.1.4.

Best regards,

Heikki Tuuri
Innobase Oy
Foreign keys, transactions, and row level locking for MySQL
InnoDB Hot Backup - a hot backup tool for InnoDB which also backs up MyISAM
tables
http://www.innodb.com/order.php

Order MySQL technical support from https://order.mysql.com/


----- Original Message ----- 
From: "Terry Riley" <[EMAIL PROTECTED]>
Newsgroups: mailing.database.myodbc
Sent: Tuesday, July 13, 2004 8:38 PM
Subject: Small Bug in 4.1.3 beta ?


> I have been trying out 4.1.3 beta on XP, and note that in SQLyog, Maestro,
> and even MYSQL Administrator, the number of records shown is always one
> more than actual - in InnoDB tables only. Even an empty table still shows
> as 1. This is different than the count shown in these GUIs with 4.1.1
> alpha.
>
> SELECT COUNT(*) retrieves the correct number, however.
>
> This is not the case for the MyISAM tables, which show the correct numbers
> at all times.
>
> Is this supposed to happen?
>
> Terry Riley
>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]
>


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to