Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL table stats code cleanup #19391

Merged
merged 5 commits into from
Oct 16, 2023
Merged

MySQL table stats code cleanup #19391

merged 5 commits into from
Oct 16, 2023

Conversation

findepi
Copy link
Member

@findepi findepi commented Oct 13, 2023

No description provided.

@findepi findepi requested a review from hashhar October 13, 2023 07:23
@cla-bot cla-bot bot added the cla-signed label Oct 13, 2023
Copy link
Member

@hashhar hashhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +1194 to +1196
(SELECT CARDINALITY AS row_count FROM INFORMATION_SCHEMA.STATISTICS
WHERE TABLE_SCHEMA = :schema AND TABLE_NAME = :table_name
AND CARDINALITY IS NOT NULL)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it's never possible for cardinality of any index to be > actual row count?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would guess this is still an estimate

Previously the MySQL estimated table row count was calculated taking
into account the CARDINALITY of single column indexes, and cardinality
of first column in multi-column indexes. This commit expands this to
include cardinality of every index.
@findepi findepi merged commit b3fd03d into trinodb:master Oct 16, 2023
24 checks passed
@findepi findepi deleted the findepi/stats branch October 16, 2023 12:06
@github-actions github-actions bot added this to the 430 milestone Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants